55 #define GSOAP_LIB_VERSION 208105
61 #if defined(__gnu_linux__) && !defined(_GNU_SOURCE)
62 # define _GNU_SOURCE 1
67 #if GSOAP_VERSION != GSOAP_LIB_VERSION
68 # error "GSOAP VERSION MISMATCH IN LIBRARY: PLEASE REINSTALL PACKAGE"
71 #if defined(VXWORKS) && defined(WM_SECURE_KEY_STORAGE)
72 # include <ipcom_key_db.h>
80 # pragma comment(lib, "ws2.lib")
82 # pragma comment(lib, "Ws2_32.lib")
84 # pragma warning(disable : 4996)
96 #ifndef SOAP_UNKNOWN_CHAR
97 # define SOAP_UNKNOWN_CHAR (0x7F)
101 #ifdef WITH_REPLACE_ILLEGAL_UTF8
102 # ifndef SOAP_UNKNOWN_UNICODE_CHAR
103 # define SOAP_UNKNOWN_UNICODE_CHAR (0xFFFD)
108 #define SOAP_LT (soap_wchar)(-2)
109 #define SOAP_TT (soap_wchar)(-3)
110 #define SOAP_GT (soap_wchar)(-4)
111 #define SOAP_QT (soap_wchar)(-5)
112 #define SOAP_AP (soap_wchar)(-6)
114 #define soap_coblank(c) ((c)+1 > 0 && (c) <= 32)
116 #if defined(WIN32) && !defined(UNDER_CE)
117 #define soap_hash_ptr(p) ((size_t)((PtrToUlong(p) >> 3) & (SOAP_PTRHASH - 1)))
119 #define soap_hash_ptr(p) ((size_t)(((unsigned long)(p) >> 3) & (SOAP_PTRHASH-1)))
123 static void soap_init_logs(
struct soap*);
124 static void soap_close_logfile(
struct soap*,
int);
125 static void soap_set_logfile(
struct soap*,
int,
const char*);
128 #ifdef SOAP_MEM_DEBUG
129 static void soap_init_mht(
struct soap*);
130 static void soap_free_mht(
struct soap*);
131 static void soap_track_unlink(
struct soap*,
const void*);
134 static int soap_set_error(
struct soap*,
const char*,
const char*,
const char*,
const char*,
int);
135 static int soap_copy_fault(
struct soap*,
const char*,
const char*,
const char*,
const char*);
148 static int soap_ntlm_handshake(
struct soap *
soap,
int command,
const char *endpoint,
const char *host,
int port);
166 static const wchar_t*
soap_wstring(
struct soap *
soap,
const char *s,
int flag,
long minlen,
long maxlen,
const char *pattern);
170 static const char*
soap_string(
struct soap *
soap,
const char *s,
int flag,
long minlen,
long maxlen,
const char *pattern);
172 static const char*
soap_QName(
struct soap *
soap,
const char *s,
long minlen,
long maxlen,
const char *pattern);
186 static int soap_getgziphdr(
struct soap*);
190 # ifndef SOAP_SSL_RSA_BITS
191 # define SOAP_SSL_RSA_BITS 2048
193 static int soap_ssl_init_done = 0;
194 static int ssl_auth_init(
struct soap*);
195 static int ssl_verify_callback(
int, X509_STORE_CTX*);
196 static int ssl_verify_callback_allow_expired_certificate(
int, X509_STORE_CTX*);
197 static int ssl_password(
char*,
int,
int,
void *);
201 # ifndef SOAP_SSL_RSA_BITS
202 # define SOAP_SSL_RSA_BITS 2048
204 static int soap_ssl_init_done = 0;
205 static int ssl_auth_init(
struct soap*);
206 static const char *ssl_verify(
struct soap *
soap,
const char *host);
207 # if GNUTLS_VERSION_NUMBER < 0x020b00
208 # if defined(HAVE_PTHREAD_H)
209 # include <pthread.h>
211 GCRY_THREAD_OPTION_PTHREAD_IMPL;
212 # elif defined(HAVE_PTH_H)
215 GCRY_THREAD_OPTION_PTH_IMPL;
220 #ifdef WITH_SYSTEMSSL
221 static int ssl_auth_init(
struct soap*);
222 static int ssl_recv(
int sk,
void *s,
int n,
char *user);
223 static int ssl_send(
int sk,
void *s,
int n,
char *user);
226 #if !defined(WITH_NOHTTP) || !defined(WITH_LEANER)
227 static const char *
soap_decode(
char*,
size_t,
const char*,
const char*);
238 static int http_post(
struct soap*,
const char*,
const char*,
int,
const char*,
const char*,
ULONG64);
248 static int fsend(
struct soap*,
const char*,
size_t);
249 static size_t frecv(
struct soap*,
char*,
size_t);
253 #if !defined(WITH_IPV6)
254 static int tcp_gethost(
struct soap*,
const char *addr,
struct in_addr *inaddr);
256 #if !defined(WITH_IPV6) || defined(WITH_COOKIES)
257 static int tcp_gethostbyname(
struct soap*,
const char *addr,
struct hostent *hostent,
struct in_addr *inaddr);
268 #define SOAP_TCP_SELECT_RCV 0x1
269 #define SOAP_TCP_SELECT_SND 0x2
270 #define SOAP_TCP_SELECT_ERR 0x4
271 #define SOAP_TCP_SELECT_ALL 0x7
272 #define SOAP_TCP_SELECT_PIP 0x8
275 #define SOAP_SOCKBLOCK(fd) \
277 u_long blocking = 0; \
278 ioctlsocket(fd, FIONBIO, &blocking); \
280 #define SOAP_SOCKNONBLOCK(fd) \
282 u_long nonblocking = 1; \
283 ioctlsocket(fd, FIONBIO, &nonblocking); \
285 #elif defined(VXWORKS)
286 #define SOAP_SOCKBLOCK(fd) \
288 u_long blocking = 0; \
289 ioctl(fd, FIONBIO, (int)(&blocking)); \
291 #define SOAP_SOCKNONBLOCK(fd) \
293 u_long nonblocking = 1; \
294 ioctl(fd, FIONBIO, (int)(&nonblocking)); \
297 #define SOAP_SOCKBLOCK(fd) \
300 ioctl(fd, FIONBIO, &blocking); \
302 #define SOAP_SOCKNONBLOCK(fd) \
304 int nonblocking = 1; \
305 ioctl(fd, FIONBIO, &nonblocking); \
307 #elif defined(SYMBIAN)
308 #define SOAP_SOCKBLOCK(fd) \
311 ioctl(fd, 0, &blocking); \
313 #define SOAP_SOCKNONBLOCK(fd) \
315 long nonblocking = 1; \
316 ioctl(fd, 0, &nonblocking); \
319 #define SOAP_SOCKBLOCK(fd) (void)fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)&~O_NONBLOCK);
320 #define SOAP_SOCKNONBLOCK(fd) (void)fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)|O_NONBLOCK);
325 static const char soap_env1[42] =
"http://schemas.xmlsoap.org/soap/envelope/";
326 static const char soap_enc1[42] =
"http://schemas.xmlsoap.org/soap/encoding/";
327 static const char soap_env2[40] =
"http://www.w3.org/2003/05/soap-envelope";
328 static const char soap_enc2[40] =
"http://www.w3.org/2003/05/soap-encoding";
329 static const char soap_rpc[35] =
"http://www.w3.org/2003/05/soap-rpc";
332 const char soap_base64o[65] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
333 const char soap_base64i[81] =
"\76XXX\77\64\65\66\67\70\71\72\73\74\75XXXXXXX\00\01\02\03\04\05\06\07\10\11\12\13\14\15\16\17\20\21\22\23\24\25\26\27\30\31XXXXXX\32\33\34\35\36\37\40\41\42\43\44\45\46\47\50\51\52\53\54\55\56\57\60\61\62\63";
336 static const char soap_indent[21] =
"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
343 # define SOAP_CANARY (0xC0DE)
347 #define SOAP_STR_PADDING (soap_padding)
348 #define SOAP_STR_EOS (soap_padding)
349 #define SOAP_NON_NULL (soap_padding)
458 #ifdef HOST_NOT_FOUND
459 { HOST_NOT_FOUND,
"Host not found" },
462 { TRY_AGAIN,
"Try Again" },
465 { NO_RECOVERY,
"No Recovery" },
468 { NO_DATA,
"No Data" },
471 { NO_ADDRESS,
"No Address" },
483 { 101,
"Switching Protocols" },
487 { 203,
"Non-Authoritative Information" },
488 { 204,
"No Content" },
489 { 205,
"Reset Content" },
490 { 206,
"Partial Content" },
491 { 300,
"Multiple Choices" },
492 { 301,
"Moved Permanently" },
494 { 303,
"See Other" },
495 { 304,
"Not Modified" },
496 { 305,
"Use Proxy" },
497 { 307,
"Temporary Redirect" },
498 { 400,
"Bad Request" },
499 { 401,
"Unauthorized" },
500 { 402,
"Payment Required" },
501 { 403,
"Forbidden" },
502 { 404,
"Not Found" },
503 { 405,
"Method Not Allowed" },
504 { 406,
"Not Acceptable" },
505 { 407,
"Proxy Authentication Required" },
506 { 408,
"Request Time-out" },
509 { 411,
"Length Required" },
510 { 412,
"Precondition Failed" },
511 { 413,
"Request Entity Too Large" },
512 { 414,
"Request-URI Too Large" },
513 { 415,
"Unsupported Media Type" },
514 { 416,
"Requested range not satisfiable" },
515 { 417,
"Expectation Failed" },
516 { 422,
"Unprocessable Entity" },
517 { 426,
"Upgrade Required" },
518 { 428,
"Precondition Required" },
519 { 429,
"Too Many Requests" },
520 { 431,
"Request Header Fields Too Large" },
521 { 500,
"Internal Server Error" },
522 { 501,
"Not Implemented" },
523 { 502,
"Bad Gateway" },
524 { 503,
"Service Unavailable" },
525 { 504,
"Gateway Time-out" },
526 { 505,
"HTTP Version not supported" },
527 { 511,
"Network Authentication Required" },
536 #define _SSL_ERROR(e) { e, #e }
537 _SSL_ERROR(SSL_ERROR_SSL),
538 _SSL_ERROR(SSL_ERROR_ZERO_RETURN),
539 _SSL_ERROR(SSL_ERROR_WANT_READ),
540 _SSL_ERROR(SSL_ERROR_WANT_WRITE),
541 _SSL_ERROR(SSL_ERROR_WANT_CONNECT),
542 _SSL_ERROR(SSL_ERROR_WANT_X509_LOOKUP),
543 _SSL_ERROR(SSL_ERROR_SYSCALL),
563 static int tcp_done = 0;
566 #if (defined(_AIX43) || defined(TRU64) || defined(HP_UX)) && defined(HAVE_GETHOSTBYNAME_R)
581 #if defined(__cplusplus) && !defined(WITH_COMPAT)
584 soap->
os->write(s, (std::streamsize)n);
602 #ifdef WITH_SELF_PIPE
613 #ifdef WITH_SYSTEMSSL
621 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Connection closed by self pipe\n"));
635 #ifdef WITH_SYSTEMSSL
656 time_t now = time(
NULL);
664 nwritten = SSL_write(
soap->
ssl, s, (
int)n);
666 nwritten = BIO_write(
soap->
bio, s, (
int)n);
671 nwritten = gnutls_record_send(
soap->
session, s, n);
674 #ifdef WITH_SYSTEMSSL
677 err = gsk_secure_socket_write(
soap->
ssl, (
char*)s, n, &nwritten);
700 udp_delay = ((
unsigned int)
soap_random % 201) + 50;
711 }
while (nwritten < 0 && --udp_repeat > 0);
736 if (
soap->
ssl && (r = SSL_get_error(
soap->
ssl, nwritten)) != SSL_ERROR_NONE && r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE)
745 if (nwritten == GNUTLS_E_INTERRUPTED)
747 else if (nwritten == GNUTLS_E_AGAIN)
753 #if defined(WITH_OPENSSL)
754 if (
soap->
ssl && r == SSL_ERROR_WANT_READ)
757 #elif defined(WITH_GNUTLS)
779 nwritten = fwrite((
void*)s, 1, n, stdout);
788 nwritten = (httpBlockPut(
soap->rpmreqid, (
char*)s, n) == 0) ? n : -1;
792 nwritten = _write(
soap->
sendfd, s, (
unsigned int)n);
932 DBGMSG(SENT, t, strlen(t));
1080 for (s = val; *s; s++)
1081 if (*s !=
' ' && *s !=
'=')
1087 while (*s && *s !=
'"' && --len)
1091 while (*s && *s !=
'&' && *s !=
'=');
1096 while (*s && *s !=
'&' && *s !=
'=' && --len)
1111 *t++ = ((s[1] >=
'A' ? (s[1]&0x7) + 9 : s[1] -
'0') << 4) + (s[2] >=
'A' ? (s[2]&0x7) + 9 : s[2] -
'0');
1134 #if defined(__cplusplus) && !defined(WITH_COMPAT)
1138 return (
size_t)
soap->
is->read(s, (std::streamsize)n).gcount();
1159 #if defined(WITH_OPENSSL) || defined(WITH_SYSTEMSSL)
1170 #ifdef WITH_SELF_PIPE
1174 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Connection closed by self pipe\n"));
1192 time_t now = time(
NULL);
1201 r = SSL_read(
soap->
ssl, s, (
int)n);
1204 err = SSL_get_error(
soap->
ssl, r);
1205 if (err != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE)
1210 r = BIO_read(
soap->
bio, s, (
int)n);
1226 #ifdef WITH_SYSTEMSSL
1229 err = gsk_secure_socket_read(
soap->
ssl, s, n, &r);
1230 if (err == GSK_OK && r > 0)
1232 if (err != GSK_OK && err != GSK_WOULD_BLOCK && err != GSK_WOULD_BLOCK_WRITE)
1271 #if defined(WITH_OPENSSL)
1272 if (
soap->
ssl && err == SSL_ERROR_WANT_WRITE)
1275 #elif defined(WITH_GNUTLS)
1279 #elif defined(WITH_SYSTEMSSL)
1280 if (
soap->
ssl && err == GSK_WOULD_BLOCK_WRITE)
1298 return fread(s, 1, n, stdin);
1305 r = httpBlockRead(
soap->rpmreqid, s, n);
1345 return (
c >=
'0' &&
c <=
'9') || (
c >=
'A' &&
c <=
'F') || (
c >=
'a' &&
c <=
'f');
1356 #if !defined(WITH_LEANER) || defined(WITH_ZLIB)
1369 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Inflating\n"));
1396 soap->
d_stream->msg = (
char*)
"caught SOAP_MINDEFLATERATIO explosive decompression guard (remedy: increase SOAP_MAXINFLATESIZE and/or decrease SOAP_MINDEFLATERATIO)";
1399 DBGLOG(RECV, SOAP_MESSAGE(fdebug,
"\n---- decompressed ----\n"));
1401 DBGLOG(RECV, SOAP_MESSAGE(fdebug,
"\n----\n"));
1422 DBGLOG(RECV, SOAP_MESSAGE(fdebug,
"\n---- compressed ----\n"));
1435 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Getting chunk: read %u bytes\n", (
unsigned int)
ret));
1449 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Read %u bytes (chunked) from socket=%d\n", (
unsigned int)
ret, (
int)
soap->
socket));
1477 while ((
int)
c != EOF &&
c !=
'\n')
1485 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Chunk size = %s (hex)\n", tmp));
1490 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"End of chunked message\n"));
1551 soap->
d_stream->msg = (
char*)
"caught SOAP_MINDEFLATERATIO explosive decompression guard (remedy: increase SOAP_MAXINFLATESIZE and/or decrease SOAP_MINDEFLATERATIO)";
1554 DBGLOG(RECV, SOAP_MESSAGE(fdebug,
"\n---- decompressed ----\n"));
1604 unsigned char tmp[12];
1605 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"DIME hdr for chunked SOAP in DIME is in buffer\n"));
1619 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Get DIME hdr for next SOAP in DIME chunk\n"));
1621 for (i = 12; i > 0; i--)
1631 soap->
dime.
size = ((size_t)tmp[8] << 24) | ((size_t)tmp[9] << 16) | ((size_t)tmp[10] << 8) | ((size_t)tmp[11]);
1632 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Get SOAP in DIME chunk (%u bytes)\n", (
unsigned int)
soap->
dime.
size));
1644 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Chunked SOAP in DIME (%u bytes buffered)\n", (
unsigned int)
soap->
buflen));
1670 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Chunked SOAP in DIME (%u bytes buffered)\n", (
unsigned int)
soap->
buflen));
1701 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Filtered output continued %lu bytes\n", (
unsigned long)
soap->
buflen));
1718 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Filtered output %lu bytes\n", (
unsigned long)
soap->
buflen));
1762 if (code_map && str)
1766 if (!strcmp(str, code_map->
string))
1786 return code_map->
code;
1820 for (p = code_map; p->
string; p++)
1822 size_t n = strlen(p->
string);
1827 while (*str > 0 && *str <= 32)
1853 const char *s = code_map->
string;
1856 while (*s && t < soap->tmpbuf +
sizeof(
soap->
tmpbuf) - 1)
1879 int r = strcmp(s,
a[mid]);
1899 for (i = 0; i < (int)
sizeof(tmp)-1; i++)
1902 if (
c ==
';' || (
int)
c == EOF)
1909 if (tmp[1] ==
'x' || tmp[1] ==
'X')
1913 if (!strcmp(tmp,
"lt"))
1915 if (!strcmp(tmp,
"gt"))
1917 if (!strcmp(tmp,
"amp"))
1919 if (!strcmp(tmp,
"quot"))
1921 if (!strcmp(tmp,
"apos"))
1972 while ((
int)
c != EOF)
2012 if (
c ==
'!' ||
c ==
'?' ||
c ==
'%')
2023 }
while ((
int)
c != EOF &&
c !=
'[');
2037 }
while ((
int)
c != EOF);
2044 while ((
int)
c != EOF)
2087 size_t i =
sizeof(buf);
2100 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"XML PI <?%s?>\n", buf));
2101 if (!strncmp(buf,
"xml ", 4))
2103 s = strstr(buf,
" encoding=");
2109 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Switching to latin encoding\n"));
2114 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Switching to utf-8 encoding\n"));
2160 if ((c < 0x7F && c > 0x1F))
2165 #ifdef WITH_REPLACE_ILLEGAL_UTF8
2166 if (!(
c == 0x09 ||
c == 0x0A ||
c == 0x0D || (
c >= 0x80 &&
c <= 0xD7FF) || (
c >= 0xE000 &&
c <= 0xFFFD) || (
c >= 0x10000 &&
c <= 0x10FFFF)))
2167 c = SOAP_UNKNOWN_UNICODE_CHAR;
2175 *t++ = (char)(0xC0 | ((
c >> 6) & 0x1F));
2181 *t++ = (char)(0xE0 | ((
c >> 12) & 0x0F));
2187 *t++ = (char)(0xF0 | ((
c >> 18) & 0x07));
2193 *t++ = (char)(0xF8 | ((
c >> 24) & 0x03));
2197 *t++ = (char)(0xFC | ((
c >> 30) & 0x01));
2198 *t++ = (char)(0x80 | ((
c >> 24) & 0x3F));
2200 *t++ = (char)(0x80 | ((
c >> 18) & 0x3F));
2202 *t++ = (char)(0x80 | ((
c >> 12) & 0x3F));
2204 *t++ = (char)(0x80 | ((
c >> 6) & 0x3F));
2206 *t++ = (char)(0x80 | (
c & 0x3F));
2222 #ifdef WITH_REPLACE_ILLEGAL_UTF8
2234 #ifdef WITH_REPLACE_ILLEGAL_UTF8
2236 if (
c <= 0xC1 || (c1 & 0xC0) != 0x80)
2239 return SOAP_UNKNOWN_UNICODE_CHAR;
2243 return (((
c & 0x1F) << 6) | c1);
2245 if ((
c == 0xE0 && c1 < 0x20) || (c2 & 0xC0) != 0x80)
2248 return SOAP_UNKNOWN_UNICODE_CHAR;
2252 return (((
c & 0x0F) << 12) | (c1 << 6) | c2);
2254 if ((
c == 0xF0 && c1 < 0x10) || (
c == 0xF4 && c1 >= 0x10) ||
c >= 0xF5 || (c3 & 0xC0) != 0x80)
2257 return SOAP_UNKNOWN_UNICODE_CHAR;
2259 return (((
c & 0x07) << 18) | (c1 << 12) | (c2 << 6) | (c3 & 0x3F));
2262 if (
c < 0xC0 || (c1 & 0xC0) != 0x80)
2273 return ((
soap_wchar)(
c & 0x0F) << 12) | (c1 << 6) | c2;
2276 return ((
soap_wchar)(
c & 0x07) << 18) | (c1 << 12) | (c2 << 6) | c3;
2279 return ((
soap_wchar)(
c & 0x03) << 24) | (c1 << 18) | (c2 << 12) | (c3 << 6) | c4;
2293 if ((*s++ & 0xC0) != 0x80)
2318 p[0] = (char)((m >> 4) + (m > 159 ?
'7' :
'0'));
2320 p[1] = (char)(m + (m > 9 ?
'7' :
'0'));
2322 if (p -
d ==
sizeof(
d))
2360 for (i = 0; i < k; i++)
2381 unsigned char *p =
NULL;
2398 *s++ = (char)(((
d1 >=
'A' ? (
d1 & 0x7) + 9 :
d1 -
'0') << 4) + (d2 >=
'A' ? (d2 & 0x7) + 9 : d2 -
'0'));
2451 *s++ = ((
d1 >=
'A' ? (
d1 & 0x7) + 9 :
d1 -
'0') << 4) + (d2 >=
'A' ? (d2 & 0x7) + 9 : d2 -
'0');
2483 for (; n > 2; n -= 3, s += 3)
2486 p[1] =
soap_base64o[((s[0] & 0x03) << 4) | ((s[1] & 0xF0) >> 4)];
2487 p[2] =
soap_base64o[((s[1] & 0x0F) << 2) | ((s[2] & 0xC0) >> 6)];
2490 if (p -
d ==
sizeof(
d))
2500 p[1] =
soap_base64o[((s[0] & 0x03) << 4) | ((s[1] & 0xF0) >> 4)];
2547 for (i = 0; i < k - 2; i += 3)
2549 unsigned long m = 0;
2556 if (
c ==
'=' ||
c < 0)
2558 unsigned char *p =
NULL;
2562 *s++ = (char)((m >> 4) & 0xFF);
2566 *s++ = (char)((m >> 10) & 0xFF);
2567 *s++ = (char)((m >> 2) & 0xFF);
2590 if (
c >= 0 &&
c <= 79)
2607 *s++ = (char)((m >> 16) & 0xFF);
2608 *s++ = (char)((m >> 8) & 0xFF);
2609 *s++ = (char)(m & 0xFF);
2633 unsigned long m = 0;
2640 if (
c ==
'=' ||
c < 0)
2647 *s++ = (char)((m >> 4) & 0xFF);
2652 *s++ = (char)((m >> 10) & 0xFF);
2653 *s++ = (char)((m >> 2) & 0xFF);
2675 if (
c >= 0 &&
c <= 79)
2692 *s++ = (char)((m >> 16) & 0xFF);
2693 *s++ = (char)((m >> 8) & 0xFF);
2694 *s++ = (char)(m & 0xFF);
2794 size_t n = strlen(s) + 1;
2800 (void)
soap_memcpy((
void*)t, n, (
const void*)s, n);
2822 m =
sizeof(wchar_t) * n;
2828 (void)
soap_memcpy((
void*)t, m, (
const void*)s, m);
2847 while ((*s >= 9 && *s <= 13) || *s == 32)
2852 while (--t > s && ((*t >= 9 && *t <= 13) || *t == 32))
2870 while ((*s >= 9 && *s <= 13) || *s == 32)
2875 while (--t > s && ((*t >= 9 && *t <= 13) || *t == 32))
2916 ||
b->size + n < b->
size
2933 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Push block %p of %u bytes on %lu previous blocks (%lu bytes total)\n", (
void*)p, (
unsigned int)n, (
unsigned long)
b->item, (
unsigned long)
b->size));
2935 return (
void*)(p + 1);
2969 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Pop block %p (%lu items of %lu bytes total)\n", (
void*)p, (
unsigned long)
b->item, (
unsigned long)
b->size));
2980 const void *start = src, *end = src + len;
2984 #ifndef WITH_NOIDREF
2988 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Update pointers %p (%lu bytes) -> %p\n", (
void*)src, (
unsigned long)len, (
void*)dst));
2998 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Update shaky id='%s'\n", ip->
id));
2999 if (ip->
ptr && ip->
ptr >= start && ip->
ptr < end)
3001 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Update ptr %p -> %p\n", ip->
ptr, (
void*)((
const char*)ip->
ptr + (dst-src))));
3002 ip->
ptr = (
void*)((
const char*)ip->
ptr + (dst-src));
3004 for (q = &ip->
link; q; q = (
void**)p)
3007 if (p && p >= start && p < end)
3009 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Link update id='%s' %p -> %p\n", ip->
id, p, (
void*)((
const char*)p + (dst-src))));
3010 *q = (
void*)((
const char*)p + (dst-src));
3013 for (q = &ip->
copy; q; q = (
void**)p)
3016 if (p && p >= start && p < end)
3018 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Copy chain update id='%s' %p -> %p\n", ip->
id, p, (
void*)((
const char*)p + (dst-src))));
3019 *q = (
void*)((
const char*)p + (dst-src));
3024 if (fp->
ptr >= start && fp->
ptr < end)
3026 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Copy list update id='%s' target type=%d %p -> %p\n", ip->
id, fp->
type, fp->
ptr, (
void*)((
char*)fp->
ptr + (dst-src))));
3027 fp->
ptr = (
void*)((
const char*)fp->
ptr + (dst-src));
3032 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Smart shared pointer update %p -> %p\n", ip->
smart, (
void*)((
const char*)ip->
smart + (dst-src))));
3033 ip->
smart = (
void*)((
const char*)ip->
smart + (dst-src));
3040 (void)
soap; (void)start; (void)end; (void)dst; (void)src;
3045 if (xp->
ptr && (
void*)xp->
ptr >= start && (
void*)xp->
ptr < end)
3047 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Update attachment id='%s' %p -> %p\n", xp->
id ? xp->
id :
SOAP_STR_EOS, (
void*)xp->
ptr, (
void*)((
char*)xp->
ptr + (dst-src))));
3048 xp->
ptr = (
unsigned char**)((
char*)xp->
ptr + (dst-src));
3049 xp->
size = (
int*)((
char*)xp->
size + (dst-src));
3050 xp->
type = (
char**)((
char*)xp->
type + (dst-src));
3059 #ifndef WITH_NOIDREF
3071 for (p = (
const char*)ip->
copy; p; p = *(
const char**)p)
3072 if (p >= start && p < end)
3075 if (fp->
type == ip->
type && (
const char*)fp->
ptr >= start && (
const char*)fp->
ptr < end)
3085 #ifndef WITH_NOIDREF
3094 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Resolving forwarded refs\n"));
3106 q = (
void**)ip->
link;
3108 DBGLOG(
TEST,
if (q) SOAP_MESSAGE(fdebug,
"Traversing link chain to resolve id='%s' type=%d\n", ip->
id, ip->
type));
3113 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"... link %p -> %p\n", (
void*)q, ip->
ptr));
3120 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"... insert type=%d link %p -> %p\n", fp->
type, fp->
ptr, ip->
ptr));
3123 else if (fp->
level == 1)
3143 else if (*ip->
id ==
'#')
3145 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Missing id='%s'\n", ip->
id));
3155 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Resolution phase\n"));
3166 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Resolving id='%s' type=%d ptr=%p size=%lu ...\n", ip->
id, ip->
type, ip->
ptr, (
unsigned long)ip->
size));
3169 void *p, **q = (
void**)ip->
copy;
3170 DBGLOG(
TEST,
if (q) SOAP_MESSAGE(fdebug,
"Traversing copy chain to resolve id='%s'\n", ip->
id));
3174 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"... copy %p -> %p (%u bytes)\n", ip->
ptr, (
void*)q, (
unsigned int)ip->
size));
3181 while ((fp = ip->
flist))
3183 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Resolving forwarded data type=%d target type=%d location=%p level=%u id='%s'\n", ip->
type, fp->
type, ip->
ptr, fp->
level, ip->
id));
3186 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"... copy %p -> %p (%lu bytes)\n", ip->
ptr, fp->
ptr, (
unsigned long)ip->
size));
3197 else if (*ip->
id ==
'#')
3205 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Resolution error: forwarded data for id='%s' could not be propagated, please report this problem to the gSOAP developers\n",
id));
3208 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Resolution done\n"));
3224 b->size -=
b->head->size - n;
3252 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"First block %p\n", (
void*)(r + 1)));
3253 return (
char*)(r + 1);
3270 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Next block %p, deleting current block\n", (
void*)(
b->head ?
b->head + 1 :
NULL)));
3273 return (
char*)(
b->head + 1);
3287 return b->head->size;
3302 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"End of block sequence, free all remaining blocks\n"));
3303 for (p =
b->head; p; p = q)
3324 DBGLOG(
TEST,
if (
soap->
blist) SOAP_MESSAGE(fdebug,
"Restored previous block sequence\n"));
3325 #ifndef WITH_NOIDREF
3352 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Save all %lu blocks in contiguous memory space of %u bytes (%p->%p)\n", (
unsigned long)
b->item, (
unsigned int)
b->size, (
void*)
b->head, (
void*)p));
3359 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Copy %u bytes from %p to %p\n", (
unsigned int)n, (
void*)q, (
void*)s));
3362 (void)
soap_memcpy((
void*)s, n, (
const void*)q, n);
3381 const char *t =
",%d";
3389 for (i = 1; i < dim; i++)
3398 for (i = 1; i < dim; i++)
3420 for (i = 1; i < dim; i++)
3441 n = (size_t)
size[0];
3442 for (i = 1; i < dim; i++)
3446 n *= (size_t)
size[i];
3466 if (attr[i - 1] ==
'[' || attr[i - 1] ==
',' || attr[i - 1] ==
' ')
3469 size[--dim] = (int)k;
3472 }
while (dim > 0 && --i > 0 && attr[i] !=
'[');
3486 for (i = 0; i < dim && attr && *attr; i++)
3491 attr = strchr(attr,
',');
3496 for (i = 0; i < dim && attr && *attr; i++)
3501 attr = strchr(attr,
',');
3522 while (attr[i] && attr[i] !=
',' && attr[i] !=
']')
3526 }
while (n <
SOAP_MAXDIMS && attr[i] && attr[i] !=
']');
3546 for (i = 0; p->
id; p++, i++)
3548 if (p->
ns && !strcmp(
ns, p->
ns))
3552 if (!strcmp(
ns, p->
out))
3584 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Push namespace binding (level=%u,index=%hd) '%s'='%s'\n",
soap->
level, i,
id,
ns));
3587 np->
ns = np->
id + n + 1;
3589 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Push NOT OK: no match found for '%s' in namespace mapping table (added to stack anyway)\n",
ns));
3594 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Push OK ('%s' matches '%s' in namespace table)\n",
id, p->
id));
3625 while (np && (strncmp(np->
id, id1, n1) || np->
id[n1]))
3639 if ((n1 == 3 && n1 == n2 && !strncmp(id1,
"xml", 3) && !strncmp(id1, id2, 3))
3654 if (!tag || !strncmp(tag,
"xml", 3))
3657 s = strchr(tag,
':');
3660 while (np && *np->
id)
3665 while (np && (strncmp(np->
id, tag, s - tag) || np->
id[s - tag]))
3681 while (np && *np->
id);
3698 if (!tag || !strncmp(tag,
"xml", 3))
3700 s = strchr(tag,
':');
3704 while (np && (strncmp(np->
id, tag, s - tag) || np->
id[s - tag]))
3712 if (np->
ns && *np->
ns)
3725 const char *
a =
NULL;
3726 const char *
b =
NULL;
3731 if (!c1 || c1 ==
'"')
3737 if (c1 >=
'A' && c1 <=
'Z')
3742 if (c2 >=
'A' && c2 <=
'Z')
3766 if (*t ==
'*' && !t[1])
3780 if (!tag1 || !tag2 || !*tag2)
3782 s = strchr(tag1,
':');
3783 t = strchr(tag2,
':');
3795 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Tags '%s' and '%s' match but namespaces differ\n", tag1, tag2));
3816 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Tags '%s' and '%s' match but namespaces differ\n", tag1, tag2));
3822 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Tags and (default) namespaces match: '%s' '%s'\n", tag1, tag2));
3831 #ifndef WITH_NOEMPTYNAMESPACES
3838 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Tags match: '%s' '%s'\n", tag1, tag2));
3851 if (!tag1 || !tag2 || !*tag2)
3853 s = strchr(tag1,
':');
3854 t = strchr(tag2,
':');
3866 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Atts '%s' and '%s' match but namespaces differ\n", tag1, tag2));
3873 else if (!t[1] || t != tag2 ||
SOAP_STRCMP(tag1, t + 1))
3875 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Atts and (default) namespaces match: '%s' '%s'\n", tag1, tag2));
3885 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Atts match: '%s' '%s'\n", tag1, tag2));
3925 if (!soap_ssl_init_done)
3927 #if OPENSSL_VERSION_NUMBER < 0x10100000L
3928 RAND_pseudo_bytes((
unsigned char*)&r,
sizeof(
int));
3930 RAND_bytes((
unsigned char*)&r,
sizeof(
int));
3938 #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS) || defined(WITH_SYSTEMSSL)
3942 #if defined(VXWORKS) && defined(WM_SECURE_KEY_STORAGE)
3943 soap_ssl_server_context(
struct soap *
soap,
unsigned short flags,
const char *keyfile,
const char *keyid,
const char *password,
const char *cafile,
const char *capath,
const char *dhfile,
const char *randfile,
const char *sid)
3945 soap_ssl_server_context(
struct soap *
soap,
unsigned short flags,
const char *keyfile,
const char *password,
const char *cafile,
const char *capath,
const char *dhfile,
const char *randfile,
const char *sid)
3950 #if defined(VXWORKS) && defined(WM_SECURE_KEY_STORAGE)
3957 soap->dhfile = dhfile;
3958 soap->randfile = randfile;
3964 (void)randfile; (void)sid;
3972 if (n >= 512 && s && *s ==
'\0')
3973 gnutls_dh_params_generate2(
soap->
dh_params, (
unsigned int)n);
3976 unsigned int dparams_len;
3977 unsigned char dparams_buf[1024];
3978 FILE *fd = fopen(dhfile,
"r");
3981 dparams_len = (
unsigned int)fread(dparams_buf, 1,
sizeof(dparams_buf), fd);
3983 gnutls_datum_t dparams = {
3984 dparams_buf, dparams_len };
3985 if (gnutls_dh_params_import_pkcs3(
soap->
dh_params, &dparams, GNUTLS_X509_FMT_PEM))
3991 #if GNUTLS_VERSION_NUMBER < 0x030300
3994 gnutls_rsa_params_generate2(
soap->
rsa_params, SOAP_SSL_RSA_BITS);
4004 gnutls_certificate_free_credentials(
soap->xcred);
4008 #ifdef WITH_SYSTEMSSL
4009 (void)randfile; (void)sid;
4011 gsk_environment_close(&
soap->
ctx);
4018 SSL_CTX_set_session_id_context(
soap->
ctx, (
unsigned char*)sid, (
unsigned int)strlen(sid));
4020 SSL_CTX_set_session_cache_mode(
soap->
ctx, SSL_SESS_CACHE_OFF);
4029 #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS) || defined(WITH_SYSTEMSSL)
4033 #if defined(VXWORKS) && defined(WM_SECURE_KEY_STORAGE)
4034 soap_ssl_client_context(
struct soap *
soap,
unsigned short flags,
const char *keyfile,
const char *keyid,
const char *password,
const char *cafile,
const char *capath,
const char *randfile)
4036 soap_ssl_client_context(
struct soap *
soap,
unsigned short flags,
const char *keyfile,
const char *password,
const char *cafile,
const char *capath,
const char *randfile)
4040 #if defined(VXWORKS) && defined(WM_SECURE_KEY_STORAGE)
4049 soap->randfile = randfile;
4062 gnutls_certificate_free_credentials(
soap->xcred);
4066 #ifdef WITH_SYSTEMSSL
4069 gsk_environment_close(&
soap->
ctx);
4077 #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS)
4086 #if OPENSSL_VERSION_NUMBER > 0x00907000L
4087 X509_STORE *store = SSL_CTX_get_cert_store(
soap->
ctx);
4091 X509_LOOKUP *lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
4094 ret = X509_load_crl_file(lookup, crlfile, X509_FILETYPE_PEM);
4098 X509_STORE_set_flags(store, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);
4105 if (crlfile &&
soap->xcred)
4108 if (gnutls_certificate_set_x509_crl_file(
soap->xcred, crlfile, GNUTLS_X509_FMT_PEM) < 0)
4122 #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS)
4129 if (!soap_ssl_init_done)
4131 soap_ssl_init_done = 1;
4133 #if OPENSSL_VERSION_NUMBER < 0x10100000L
4135 OpenSSL_add_all_algorithms();
4137 SSL_load_error_strings();
4140 #if !defined(WIN32) && !defined(CYGWIN) && !defined(__MINGW32__) && !defined(__MINGW64__)
4141 if (!RAND_load_file(
"/dev/urandom", 1024))
4148 RAND_seed(buf,
sizeof(buf));
4150 srandom((
unsigned long)time(
NULL));
4152 srand((
unsigned int)time(
NULL));
4158 RAND_seed(&r,
sizeof(
long));
4161 RAND_seed(&r,
sizeof(
int));
4163 }
while (!RAND_status());
4167 # if GNUTLS_VERSION_NUMBER < 0x020b00
4168 # if defined(HAVE_PTHREAD_H)
4169 gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
4170 # elif defined(HAVE_PTH_H)
4171 gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth);
4173 gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM, 0);
4174 gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
4175 gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
4177 # if GNUTLS_VERSION_NUMBER < 0x030300
4178 gnutls_global_init();
4187 #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS)
4194 soap_ssl_init_done = 1;
4200 #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS)
4211 if (ERR_peek_error())
4214 while ((r = ERR_get_error()))
4224 if (ERR_GET_REASON(r) == SSL_R_CERTIFICATE_VERIFY_FAILED &&
l <
sizeof(
soap->
msgbuf))
4226 const char *s = X509_verify_cert_error_string(SSL_get_verify_result(
soap->
ssl));
4237 soap_strcpy(
soap->
msgbuf +
l,
sizeof(
soap->
msgbuf) -
l,
"EOF was observed that violates the SSL/TLS protocol. The client probably provided invalid authentication information.");
4253 return gnutls_strerror(
ret);
4260 #ifdef WITH_SYSTEMSSL
4262 ssl_recv(
int sk,
void *s,
int n,
char *user)
4265 return recv(sk, s, n, 0);
4271 #ifdef WITH_SYSTEMSSL
4273 ssl_send(
int sk,
void *s,
int n,
char *user)
4276 return send(sk, s, n, 0);
4282 #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS) || defined(WITH_SYSTEMSSL)
4287 #if OPENSSL_VERSION_NUMBER >= 0x10101000L
4288 int minv = 0, maxv = 0;
4290 long flags = SSL_OP_ALL;
4292 #if defined(VXWORKS) && defined(WM_SECURE_KEY_STORAGE)
4295 if (!soap_ssl_init_done)
4300 #if OPENSSL_VERSION_NUMBER >= 0x10100000L
4302 soap->
ctx = SSL_CTX_new(TLS_method());
4305 soap->
ctx = SSL_CTX_new(SSLv23_method());
4311 SSL_CTX_set_mode(
soap->
ctx, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_AUTO_RETRY);
4316 if (!RAND_load_file(
soap->randfile, -1))
4328 if (!SSL_CTX_set_default_verify_paths(
soap->
ctx))
4345 SSL_CTX_set_default_passwd_cb(
soap->
ctx, ssl_password);
4347 #ifndef WM_SECURE_KEY_STORAGE
4357 SSL_CTX_set_default_passwd_cb(
soap->
ctx, ssl_password);
4378 #if defined(VXWORKS) && defined(WM_SECURE_KEY_STORAGE)
4380 pkey = ipcom_key_db_pkey_get(
soap->
keyid);
4383 if (!SSL_CTX_use_PrivateKey(
soap->
ctx, pkey))
4388 #if OPENSSL_VERSION_NUMBER >= 0x10002000L
4389 if (SSL_CTX_need_tmp_RSA(
soap->
ctx))
4391 unsigned long e = RSA_F4;
4392 BIGNUM *bne = BN_new();
4393 RSA *rsa = RSA_new();
4394 if (!bne || !rsa || !BN_set_word(bne, e) || !RSA_generate_key_ex(rsa, SOAP_SSL_RSA_BITS, bne,
NULL) || !SSL_CTX_set_tmp_rsa(
soap->
ctx, rsa))
4406 RSA *rsa = RSA_generate_key(SOAP_SSL_RSA_BITS, RSA_F4,
NULL,
NULL);
4407 if (!rsa || !SSL_CTX_set_tmp_rsa(
soap->
ctx, rsa))
4416 else if (
soap->dhfile)
4422 if (n >= 512 && s && *s ==
'\0')
4424 #if OPENSSL_VERSION_NUMBER >= 0x10002000L
4426 if (!DH_generate_parameters_ex(dh, n, 2,
NULL))
4431 #elif defined(VXWORKS)
4433 DH_generate_parameters_ex(dh, n, 2,
NULL);
4435 dh = DH_generate_parameters(n, 2,
NULL,
NULL);
4441 bio = BIO_new_file(
soap->dhfile,
"r");
4447 if (!dh || DH_check(dh, &n) != 1 || SSL_CTX_set_tmp_dh(
soap->
ctx, dh) < 0)
4458 #if OPENSSL_VERSION_NUMBER >= 0x10101000L
4460 minv = SSL3_VERSION;
4462 minv = TLS1_VERSION;
4464 minv = TLS1_1_VERSION;
4466 minv = TLS1_2_VERSION;
4468 minv = TLS1_3_VERSION;
4470 maxv = TLS1_3_VERSION;
4472 maxv = TLS1_2_VERSION;
4474 maxv = TLS1_1_VERSION;
4476 maxv = TLS1_VERSION;
4478 maxv = SSL3_VERSION;
4479 if (!SSL_CTX_set_min_proto_version(
soap->
ctx, minv)
4480 || !SSL_CTX_set_max_proto_version(
soap->
ctx, maxv))
4484 flags = SSL_OP_NO_SSLv2;
4486 flags |= SSL_OP_NO_SSLv3;
4487 #if OPENSSL_VERSION_NUMBER >= 0x10001000L
4489 flags |= SSL_OP_NO_TLSv1;
4491 flags |= SSL_OP_NO_TLSv1_1;
4493 flags |= SSL_OP_NO_TLSv1_2;
4496 #ifdef SSL_OP_NO_TICKET
4498 flags |= SSL_OP_NO_TICKET;
4500 SSL_CTX_set_options(
soap->
ctx, flags);
4502 mode = (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
4504 mode = SSL_VERIFY_PEER;
4506 mode = SSL_VERIFY_NONE;
4508 #if OPENSSL_VERSION_NUMBER < 0x00905100L
4509 SSL_CTX_set_verify_depth(
soap->
ctx, 1);
4511 SSL_CTX_set_verify_depth(
soap->
ctx, 9);
4517 soap_strcpy(priority,
sizeof(priority),
"PERFORMANCE");
4518 if (!soap_ssl_init_done)
4522 if (gnutls_certificate_allocate_credentials(&
soap->xcred) != GNUTLS_E_SUCCESS)
4524 #if GNUTLS_VERSION_NUMBER >= 0x030300
4525 gnutls_certificate_set_x509_system_trust(
soap->xcred);
4529 if (gnutls_certificate_set_x509_trust_file(
soap->xcred,
soap->
cafile, GNUTLS_X509_FMT_PEM) < 0)
4539 if (gnutls_certificate_set_x509_key_file2(
soap->xcred,
soap->
keyfile,
soap->
keyfile, GNUTLS_X509_FMT_PEM,
soap->
password, GNUTLS_PKCS_PKCS12_3DES | GNUTLS_PKCS_PKCS12_ARCFOUR | GNUTLS_PKCS_PKCS12_RC2_40 | GNUTLS_PKCS_PBES2_AES_128 | GNUTLS_PKCS_PBES2_AES_192 | GNUTLS_PKCS_PBES2_AES_256 | GNUTLS_PKCS_PBES2_DES) < 0)
4549 if (
ret != GNUTLS_E_SUCCESS)
4551 gnutls_credentials_set(
soap->
session, GNUTLS_CRD_CERTIFICATE,
soap->xcred);
4556 gnutls_anon_allocate_client_credentials(&
soap->acred);
4557 ret = gnutls_priority_set_direct(
soap->
session,
"PERFORMANCE:+ANON-DH:!ARCFOUR-128",
NULL);
4558 if (
ret != GNUTLS_E_SUCCESS)
4569 #if GNUTLS_VERSION_NUMBER < 0x030300
4570 int protocol_priority[] = { 0, 0, 0, 0, 0 };
4571 int *protocol = protocol_priority;
4578 gnutls_priority_init(&
soap->cache,
"NORMAL",
NULL);
4581 gnutls_credentials_set(
soap->
session, GNUTLS_CRD_CERTIFICATE,
soap->xcred);
4583 gnutls_certificate_server_set_request(
soap->
session, GNUTLS_CERT_REQUEST);
4584 gnutls_session_enable_compatibility_mode(
soap->
session);
4588 #if GNUTLS_VERSION_NUMBER < 0x030300
4590 *protocol++ = GNUTLS_SSL3;
4592 *protocol++ = GNUTLS_TLS1_0;
4594 *protocol++ = GNUTLS_TLS1_1;
4596 *protocol++ = GNUTLS_TLS1_2;
4597 if (gnutls_protocol_set_priority(
soap->
session, protocol_priority) != GNUTLS_E_SUCCESS)
4612 #ifdef WITH_SYSTEMSSL
4616 err = gsk_environment_open(&
soap->
ctx);
4618 err = gsk_attribute_set_enum(
soap->
ctx, GSK_PROTOCOL_SSLV2, GSK_PROTOCOL_SSLV2_OFF);
4625 err = gsk_attribute_set_enum(
soap->
ctx, GSK_PROTOCOL_SSLV3, GSK_PROTOCOL_SSLV3_ON);
4627 err = gsk_attribute_set_enum(
soap->
ctx, GSK_PROTOCOL_SSLV3, GSK_PROTOCOL_SSLV3_OFF);
4632 err = gsk_attribute_set_enum(
soap->
ctx, GSK_PROTOCOL_TLSV1, GSK_PROTOCOL_TLSV1_ON);
4634 err = gsk_attribute_set_enum(
soap->
ctx, GSK_PROTOCOL_TLSV1, GSK_PROTOCOL_TLSV1_OFF);
4639 err = gsk_attribute_set_enum(
soap->
ctx, GSK_PROTOCOL_TLSV1, GSK_PROTOCOL_TLSV1_1_ON);
4641 err = gsk_attribute_set_enum(
soap->
ctx, GSK_PROTOCOL_TLSV1, GSK_PROTOCOL_TLSV1_1_OFF);
4646 err = gsk_attribute_set_enum(
soap->
ctx, GSK_PROTOCOL_TLSV1, GSK_PROTOCOL_TLSV1_2_ON);
4648 err = gsk_attribute_set_enum(
soap->
ctx, GSK_PROTOCOL_TLSV1, GSK_PROTOCOL_TLSV1_2_OFF);
4655 err = gsk_environment_init(
soap->
ctx);
4668 ssl_password(
char *buf,
int num,
int rwflag,
void *userdata)
4671 if (!buf || !userdata)
4674 return (
int)strlen(buf);
4682 ssl_verify_callback(
int ok, X509_STORE_CTX *store)
4689 int err = X509_STORE_CTX_get_error(store);
4690 X509 *cert = X509_STORE_CTX_get_current_cert(store);
4691 fprintf(stderr,
"\nDEBUG mode TLS/SSL warnings:\nSSL verify error %d or warning with certificate at depth %d: %s\n", err, X509_STORE_CTX_get_error_depth(store), X509_verify_cert_error_string(err));
4692 X509_NAME_oneline(X509_get_issuer_name(cert), buf,
sizeof(buf)-1);
4693 fprintf(stderr,
" certificate issuer: %s\n", buf);
4694 X509_NAME_oneline(X509_get_subject_name(cert), buf,
sizeof(buf)-1);
4695 fprintf(stderr,
" certificate subject: %s\n", buf);
4699 case X509_V_ERR_CERT_NOT_YET_VALID:
4700 case X509_V_ERR_CERT_HAS_EXPIRED:
4701 case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
4702 case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
4703 case X509_V_ERR_UNABLE_TO_GET_CRL:
4704 case X509_V_ERR_CRL_NOT_YET_VALID:
4705 case X509_V_ERR_CRL_HAS_EXPIRED:
4706 X509_STORE_CTX_set_error(store, X509_V_OK);
4708 fprintf(stderr,
"Initialize soap_ssl_client_context with SOAP_SSL_ALLOW_EXPIRED_CERTIFICATE to allow this verification error to pass without DEBUG mode enabled\n");
4721 ssl_verify_callback_allow_expired_certificate(
int ok, X509_STORE_CTX *store)
4723 ok = ssl_verify_callback(ok, store);
4727 switch (X509_STORE_CTX_get_error(store))
4729 case X509_V_ERR_CERT_NOT_YET_VALID:
4730 case X509_V_ERR_CERT_HAS_EXPIRED:
4731 case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
4732 case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN:
4733 case X509_V_ERR_UNABLE_TO_GET_CRL:
4734 case X509_V_ERR_CRL_NOT_YET_VALID:
4735 case X509_V_ERR_CRL_HAS_EXPIRED:
4736 X509_STORE_CTX_set_error(store, X509_V_OK);
4749 ssl_verify(
struct soap *
soap,
const char *host)
4751 unsigned int status;
4752 const char *err =
NULL;
4753 int r = gnutls_certificate_verify_peers2(
soap->
session, &status);
4755 err =
"Certificate verify error";
4756 else if ((status & GNUTLS_CERT_INVALID))
4757 err =
"The certificate is not trusted";
4758 else if ((status & GNUTLS_CERT_SIGNER_NOT_FOUND))
4759 err =
"The certificate hasn't got a known issuer";
4760 else if ((status & GNUTLS_CERT_REVOKED))
4761 err =
"The certificate has been revoked";
4762 else if (gnutls_certificate_type_get(
soap->
session) == GNUTLS_CRT_X509)
4764 gnutls_x509_crt_t cert;
4765 const gnutls_datum_t *cert_list;
4766 unsigned int cert_list_size;
4767 if (gnutls_x509_crt_init(&cert) < 0)
4768 err =
"Could not get X509 certificates";
4769 else if ((cert_list = gnutls_certificate_get_peers(
soap->
session, &cert_list_size)) ==
NULL)
4770 err =
"Could not get X509 certificates";
4771 else if (gnutls_x509_crt_import(cert, &cert_list[0], GNUTLS_X509_FMT_DER) < 0)
4772 err =
"Error parsing X509 certificate";
4774 err =
"The certificate has expired";
4776 err =
"The certificate is not yet activated";
4779 if (!gnutls_x509_crt_check_hostname(cert, host))
4780 err =
"Certificate host name mismatch";
4782 gnutls_x509_crt_deinit(cert);
4790 #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS)
4800 int err = SSL_ERROR_NONE;
4821 bio = BIO_new_socket((
int)sk, BIO_NOCLOSE);
4822 SSL_set_bio(
soap->
ssl, bio, bio);
4830 else if (t > -100000)
4833 retries = t/-100000;
4836 while ((r = SSL_accept(
soap->
ssl)) <= 0)
4838 err = SSL_get_error(
soap->
ssl, r);
4839 if (err == SSL_ERROR_WANT_ACCEPT || err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE)
4841 if (err == SSL_ERROR_WANT_READ)
4867 if ((err = SSL_get_verify_result(
soap->
ssl)) != X509_V_OK)
4872 peer = SSL_get_peer_certificate(
soap->
ssl);
4888 gnutls_transport_set_ptr(
soap->
session, (gnutls_transport_ptr_t)(
long)sk);
4896 else if (t > -100000)
4899 retries = t/-100000;
4905 if (r == GNUTLS_E_AGAIN || r == GNUTLS_E_INTERRUPTED)
4931 const char *err = ssl_verify(
soap,
NULL);
4939 #ifdef WITH_SYSTEMSSL
4952 else if (t > -100000)
4955 retries = t/-100000;
4960 r = gsk_attribute_set_numeric_value(
soap->
ssl, GSK_FD, sk);
4964 r = gsk_attribute_set_enum(
soap->
ssl, GSK_SESSION_TYPE, GSK_SERVER_SESSION);
4966 r = gsk_attribute_set_buffer(
soap->
ssl, GSK_V3_CIPHER_SPECS_EXPANDED,
"0035002F000A", 0);
4968 r = gsk_attribute_set_enum(
soap->
ssl, GSK_V3_CIPHERS, GSK_V3_CIPHERS_CHAR4);
4970 r = gsk_attribute_set_callback(
soap->
ssl, GSK_IO_CALLBACK, &local_io);
4973 while ((r = gsk_secure_socket_init(
soap->
ssl)) != GSK_OK)
4975 if (r == GSK_WOULD_BLOCK_READ || r == GSK_WOULD_BLOCK_WRITE)
4977 if (r == GSK_WOULD_BLOCK_READ)
5024 if (WSAStartup(MAKEWORD(1, 1), &w))
5039 const char *msg =
NULL;
5046 msg =
"WSAStartup failed";
5066 #if !defined(WITH_IPV6) || defined(WITH_COOKIES)
5071 #if (defined(_AIX43) || defined(TRU64) || defined(HP_UX)) && defined(HAVE_GETHOSTBYNAME_R)
5072 struct hostent_data ht_data;
5073 #elif (!defined(__GLIBC__) || !defined(_GNU_SOURCE) || (!_GNU_SOURCE && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || defined(__ANDROID__) || defined(FREEBSD) || defined(__FreeBSD__)) && defined(HAVE_GETHOSTBYNAME_R)
5077 #elif defined(HAVE_GETHOSTBYNAME_R)
5088 iadd = inet_addr((
void*)addr);
5090 iadd = inet_addr((
char*)addr);
5094 if (
soap_memcpy((
void*)inaddr,
sizeof(
struct in_addr), (
const void*)&iadd,
sizeof(iadd)))
5099 #if (defined(_AIX43) || defined(TRU64) || defined(HP_UX)) && defined(HAVE_GETHOSTBYNAME_R)
5100 memset((
void*)&ht_data, 0,
sizeof(ht_data));
5101 if (gethostbyname_r(addr, hostent, &ht_data) < 0)
5106 #elif (!defined(__GLIBC__) || !defined(_GNU_SOURCE) || (!_GNU_SOURCE && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || defined(__ANDROID__) || defined(FREEBSD) || defined(__FreeBSD__)) && defined(HAVE_GETHOSTBYNAME_R)
5107 while ((r = gethostbyname_r(addr, hostent, tmpbuf, tmplen, &hostent, &
soap->
errnum)) < 0)
5121 #elif defined(HAVE_GETHOSTBYNAME_R)
5122 hostent = gethostbyname_r(addr, hostent, tmpbuf, tmplen, &
soap->
errnum);
5123 #elif defined(VXWORKS)
5128 hostint = hostGetByName((
char*)addr);
5129 if (hostint == ERROR)
5136 hostent = gethostbyname((
void*)addr);
5138 hostent = gethostbyname((
char*)addr);
5145 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Host name not found\n"));
5151 inaddr->s_addr = hostint;
5153 if (
soap_memcpy((
void*)inaddr,
sizeof(
struct in_addr), (
const void*)hostent->h_addr, (
size_t)hostent->h_length))
5155 #if (!defined(_AIX43) && !defined(TRU64) && !defined(HP_UX)) || !defined(HAVE_GETHOSTBYNAME_R)
5156 #if (!defined(__GLIBC__) || !defined(_GNU_SOURCE) || (!_GNU_SOURCE && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || defined(__ANDROID__) || defined(FREEBSD) || defined(__FreeBSD__)) && defined(HAVE_GETHOSTBYNAME_R)
5165 #if (!defined(__GLIBC__) || !defined(_GNU_SOURCE) || (!_GNU_SOURCE && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || defined(__ANDROID__) || defined(FREEBSD) || defined(__FreeBSD__)) && defined(HAVE_GETHOSTBYNAME_R)
5176 #if !defined(WITH_IPV6)
5181 struct hostent hostent;
5194 struct addrinfo hints, *res, *ressave;
5201 #if !defined(WITH_LEAN) || defined(WITH_OPENSSL) || defined(WITH_GNUTLS) || defined(WITH_SYSTEMSSL)
5210 #ifdef IP_MULTICAST_TTL
5222 memset((
void*)&hints, 0,
sizeof(hints));
5243 if (setsockopt(
soap->
socket, IPPROTO_IP, IP_MULTICAST_TTL, (
char*)&ttl,
sizeof(ttl)))
5262 #ifndef IP_MULTICAST_IF
5263 #define IP_MULTICAST_IF 2
5287 memset((
void*)&hints, 0,
sizeof(hints));
5288 hints.ai_family = PF_UNSPEC;
5291 hints.ai_socktype = SOCK_DGRAM;
5294 hints.ai_socktype = SOCK_STREAM;
5307 sk =
soap->
socket = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
5316 sk =
soap->
socket = socket(AF_INET, SOCK_DGRAM, 0);
5319 sk =
soap->
socket = socket(AF_INET, SOCK_STREAM, 0);
5333 freeaddrinfo(ressave);
5337 #ifdef WITH_SOCKET_CLOSE_ON_EXIT
5340 SetHandleInformation((
HANDLE)sk, HANDLE_FLAG_INHERIT, 0);
5343 fcntl(sk, F_SETFD, 1);
5349 struct linger linger;
5350 memset((
void*)&linger, 0,
sizeof(linger));
5353 if (setsockopt(sk, SOL_SOCKET, SO_LINGER, (
char*)&linger,
sizeof(
struct linger)))
5359 freeaddrinfo(ressave);
5368 freeaddrinfo(ressave);
5379 freeaddrinfo(ressave);
5385 if (
soap->
sndbuf > 0 && setsockopt(sk, SOL_SOCKET, SO_SNDBUF, (
char*)&
soap->
sndbuf,
sizeof(
int)))
5389 freeaddrinfo(ressave);
5395 if (
soap->
rcvbuf > 0 && setsockopt(sk, SOL_SOCKET, SO_RCVBUF, (
char*)&
soap->
rcvbuf,
sizeof(
int)))
5399 freeaddrinfo(ressave);
5410 freeaddrinfo(ressave);
5417 #ifdef TCP_KEEPINTVL
5422 freeaddrinfo(ressave);
5434 freeaddrinfo(ressave);
5446 freeaddrinfo(ressave);
5456 struct sockaddr_in6 *in6addr = (
struct sockaddr_in6*)res->ai_addr;
5461 #ifdef IP_MULTICAST_TTL
5467 if (setsockopt(sk, IPPROTO_IP, IP_MULTICAST_TTL, (
char*)&ttl,
sizeof(ttl)))
5471 freeaddrinfo(ressave);
5480 if (setsockopt(sk, IPPROTO_IP, IP_MULTICAST_IF, (
char*)
soap->
ipv4_multicast_if,
sizeof(
struct in_addr)))
5485 freeaddrinfo(ressave);
5492 #ifndef IP_MULTICAST_IF
5493 #define IP_MULTICAST_IF 2
5495 if (setsockopt(sk, IPPROTO_IP, IP_MULTICAST_IF, (
char*)
soap->
ipv4_multicast_if,
sizeof(
struct in_addr)))
5499 freeaddrinfo(ressave);
5510 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Opening socket=%d to host='%s' port=%d\n", (
int)sk, host, port));
5518 struct sockaddr_in addr;
5519 memset((
void*)&addr, 0,
sizeof(addr));
5520 addr.sin_family = AF_INET;
5523 if (inet_pton(AF_INET,
soap->
client_addr, (
void*)&addr.sin_addr) != 1 || bind(sk, (
struct sockaddr*)&addr,
sizeof(addr)))
5526 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not bind before connect\n"));
5540 struct sockaddr_in addr;
5541 memset((
void*)&addr, 0,
sizeof(addr));
5542 addr.sin_family = AF_INET;
5544 if (bind(sk, (
struct sockaddr*)&addr,
sizeof(addr)))
5547 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not bind before connect\n"));
5599 struct sockaddr_in6 addr;
5600 memset((
void*)&addr, 0,
sizeof(addr));
5601 addr.sin6_family = AF_INET6;
5608 if (bind(sk, (
struct sockaddr*)&addr,
sizeof(addr)))
5611 freeaddrinfo(ressave);
5612 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not bind before connect\n"));
5623 struct sockaddr_in addr;
5624 memset((
void*)&addr, 0,
sizeof(addr));
5625 addr.sin_family = AF_INET;
5628 if (inet_pton(AF_INET,
soap->
client_addr, (
void*)&addr.sin_addr) != 1 || bind(sk, (
struct sockaddr*)&addr,
sizeof(addr)))
5631 freeaddrinfo(ressave);
5632 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not bind before connect\n"));
5649 struct sockaddr_in6 addr;
5650 memset((
void*)&addr, 0,
sizeof(addr));
5651 addr.sin6_family = AF_INET6;
5653 if (bind(sk, (
struct sockaddr*)&addr,
sizeof(addr)))
5656 freeaddrinfo(ressave);
5657 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not bind before connect\n"));
5673 freeaddrinfo(ressave);
5693 freeaddrinfo(ressave);
5708 if (connect(sk, res->ai_addr, (
int)res->ai_addrlen))
5735 #ifdef WITH_SELF_PIPE
5739 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Connection closed by self pipe\n"));
5750 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Connect timeout\n"));
5759 freeaddrinfo(ressave);
5766 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not connect to host\n"));
5775 freeaddrinfo(ressave);
5783 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not connect to host\n"));
5794 freeaddrinfo(ressave);
5811 freeaddrinfo(ressave);
5813 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not connect to host\n"));
5826 freeaddrinfo(ressave);
5832 #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS) || defined(WITH_SYSTEMSSL)
5836 #ifdef WITH_SYSTEMSSL
5850 const char *userid, *passwd;
5909 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL required, but no ctx set\n"));
5935 #if OPENSSL_VERSION_NUMBER >= 0x1000000aL
5942 #elif (OPENSSL_VERSION_NUMBER >= 0x0090800fL) && defined(SSL_CTRL_SET_TLSEXT_HOSTNAME)
5943 if (!SSL_ctrl(
soap->
ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, (
void*)host))
5950 bio = BIO_new_socket((
int)sk, BIO_NOCLOSE);
5951 SSL_set_bio(
soap->
ssl, bio, bio);
5960 else if (t > -100000)
5963 retries = t/-100000;
5972 err = SSL_ERROR_NONE;
5976 if ((r = SSL_connect(
soap->
ssl)) <= 0)
5978 err = SSL_get_error(
soap->
ssl, r);
5979 if (err == SSL_ERROR_WANT_CONNECT || err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE)
5982 if (err == SSL_ERROR_WANT_READ)
5988 if (s == 0 && retries-- <= 0)
5990 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL/TLS connect timeout\n"));
6002 }
while (!SSL_is_init_finished(
soap->
ssl));
6012 if ((err = SSL_get_verify_result(
soap->
ssl)) != X509_V_OK)
6021 STACK_OF(CONF_VALUE) *val =
NULL;
6022 #if OPENSSL_VERSION_NUMBER >= 0x0090800fL
6023 GENERAL_NAMES *names =
NULL;
6028 X509 *peer = SSL_get_peer_certificate(
soap->
ssl);
6035 #if OPENSSL_VERSION_NUMBER < 0x0090800fL
6036 ext_count = X509_get_ext_count(peer);
6040 for (i = 0; i < ext_count; i++)
6042 X509_EXTENSION *ext = X509_get_ext(peer, i);
6043 const char *ext_str = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ext)));
6044 if (ext_str && !strcmp(ext_str,
"subjectAltName"))
6046 X509V3_EXT_METHOD *meth = (X509V3_EXT_METHOD*)X509V3_EXT_get(ext);
6047 unsigned char *
data;
6050 data = ext->value->data;
6053 #if OPENSSL_VERSION_NUMBER > 0x00907000L
6056 ext_data = ASN1_item_d2i(
NULL, &
data, ext->value->length, ASN1_ITEM_ptr(meth->it));
6059 #if OPENSSL_VERSION_NUMBER > 0x0090800fL
6060 ext_data = meth->d2i(
NULL, (
const unsigned char **)&
data, ext->value->length);
6062 ext_data = meth->d2i(
NULL, &
data, ext->value->length);
6066 val = meth->i2v(meth, ext_data,
NULL);
6070 ASN1_item_free((ASN1_VALUE*)ext_data, ASN1_ITEM_ptr(meth->it));
6072 meth->ext_free(ext_data);
6074 void *ext_data = meth->d2i(
NULL, &
data, ext->value->length);
6076 val = meth->i2v(meth, ext_data,
NULL);
6077 meth->ext_free(ext_data);
6082 for (j = 0; j < sk_CONF_VALUE_num(val); j++)
6084 CONF_VALUE *nval = sk_CONF_VALUE_value(val, j);
6085 if (nval && (!strcmp(nval->name,
"DNS") || !strcmp(nval->name,
"IP Address")) && !
soap_tag_cmp(host, nval->value))
6088 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL: host name %s match with certificate %s %s\n", host, nval->name, nval->value));
6093 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL: host name %s mismatch with certificate %s %s\n", host, nval->name, nval->value));
6096 sk_CONF_VALUE_pop_free(val, X509V3_conf_free);
6105 names = (GENERAL_NAMES*)X509_get_ext_d2i(peer, NID_subject_alt_name,
NULL,
NULL);
6108 val = i2v_GENERAL_NAMES(
NULL, names, val);
6109 sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free);
6114 for (j = 0; j < sk_CONF_VALUE_num(val); j++)
6116 CONF_VALUE *nval = sk_CONF_VALUE_value(val, j);
6117 if (nval && (!strcmp(nval->name,
"DNS") || !strcmp(nval->name,
"IP Address")) && !
soap_tag_cmp(host, nval->value))
6120 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL: host name %s match with certificate %s %s\n", host, nval->name, nval->value));
6125 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL: host name %s mismatch with certificate %s %s\n", host, nval->name, nval->value));
6128 sk_CONF_VALUE_pop_free(val, X509V3_conf_free);
6131 if (!ok && (subj = X509_get_subject_name(peer)) != 0)
6137 i = X509_NAME_get_index_by_NID(subj, NID_commonName, i);
6140 name = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(subj, i));
6143 #if OPENSSL_VERSION_NUMBER < 0x10100000L
6144 const char *tmp = (
const char*)ASN1_STRING_data(
name);
6146 const char *tmp = (
const char*)ASN1_STRING_get0_data(
name);
6151 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL: host name %s match with certificate subject %s\n", host, tmp));
6155 unsigned char *tmp =
NULL;
6156 ASN1_STRING_to_UTF8(&tmp,
name);
6162 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL: host name %s match with certificate subject %s\n", host, tmp));
6164 else if (tmp[0] ==
'*')
6166 const char *t = strchr(host,
'.');
6170 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL: host name %s match with certificate subject %s\n", host, tmp));
6175 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL: host name %s mismatch with certificate %s\n", host, tmp));
6200 gnutls_transport_set_ptr(
soap->
session, (gnutls_transport_ptr_t)(
long)sk);
6209 else if (t > -100000)
6212 retries = t/-100000;
6225 if (r == GNUTLS_E_AGAIN || r == GNUTLS_E_INTERRUPTED)
6234 if (s == 0 && retries-- <= 0)
6236 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL/TLS connect timeout\n"));
6256 const char *s = ssl_verify(
soap, host);
6265 #ifdef WITH_SYSTEMSSL
6269 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL required, but no ctx set\n"));
6282 else if (t > -100000)
6285 retries = t/-100000;
6296 r = gsk_attribute_set_numeric_value(
soap->
ssl, GSK_FD, sk);
6300 r = gsk_attribute_set_enum(
soap->
ssl, GSK_SESSION_TYPE, GSK_CLIENT_SESSION);
6302 r = gsk_attribute_set_buffer(
soap->
ssl, GSK_V3_CIPHER_SPECS_EXPANDED,
"0035002F000A", 0);
6304 r = gsk_attribute_set_enum(
soap->
ssl, GSK_V3_CIPHERS, GSK_V3_CIPHERS_CHAR4);
6306 r = gsk_attribute_set_callback(
soap->
ssl, GSK_IO_CALLBACK, &local_io);
6313 while ((r = gsk_secure_socket_init(
soap->
ssl)) != GSK_OK)
6315 if (r == GSK_WOULD_BLOCK_READ || r == GSK_WOULD_BLOCK_WRITE)
6318 if (r == GSK_WOULD_BLOCK_READ)
6324 if (s == 0 && retries-- <= 0)
6326 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL/TLS connect timeout\n"));
6340 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"SSL_connect/select error in tcp_connect\n"));
6370 fd_set fd[3], *rfd, *sfd, *efd;
6380 #if !defined(FD_SETSIZE) || defined(__QNX__) || defined(QNX)
6389 #ifdef WITH_SELF_PIPE
6390 struct pollfd pollfd[2];
6391 pollfd[1].fd =
soap->pipe_fd[0];
6392 pollfd[1].events = POLLIN;
6394 struct pollfd pollfd[1];
6396 pollfd[0].fd = (int)sk;
6397 pollfd[0].events = 0;
6399 pollfd[0].
events |= POLLIN;
6401 pollfd[0].
events |= POLLOUT;
6403 pollfd[0].
events |= POLLERR;
6408 retries = timeout - 1;
6413 #ifdef WITH_SELF_PIPE
6414 r = poll(pollfd, 2, timeout);
6416 r = poll(pollfd, 1, timeout);
6423 else if (retries-- <= 0)
6437 #ifdef WITH_SELF_PIPE
6443 if (
read(
soap->pipe_fd[0], &ch, 1) == -1)
6447 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Self pipe read error\n"));
6469 retries = timeout - 1;
6472 rfd = sfd = efd =
NULL;
6473 #ifdef WITH_SELF_PIPE
6479 FD_SET(
soap->pipe_fd[0], rfd);
6505 tv.tv_sec = -timeout / 1000000;
6506 tv.tv_usec = -timeout % 1000000;
6513 #ifdef WITH_SELF_PIPE
6514 r = select((
int)(sk >
soap->pipe_fd[0] ? sk :
soap->pipe_fd[0]) + 1, rfd, sfd, efd, &tv);
6516 r = select((
int)sk + 1, rfd, sfd, efd, &tv);
6523 else if (retries-- <= 0)
6537 #ifdef WITH_SELF_PIPE
6543 if (
read(
soap->pipe_fd[0], &ch, 1) == -1)
6547 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Self pipe read error\n"));
6572 #ifdef WITH_SOCKET_CLOSE_ON_EXIT
6575 SetHandleInformation((
HANDLE)s, HANDLE_FLAG_INHERIT, 0);
6578 fcntl(s, F_SETFD, FD_CLOEXEC);
6615 while (SSL_want_read(
soap->
ssl))
6627 #if !defined(WITH_LEAN) && !defined(WIN32)
6637 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Connection lost...\n"));
6649 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Shutdown failed: %d\n", SSL_get_error(
soap->
ssl, r)));
6672 #ifdef WITH_SYSTEMSSL
6675 gsk_secure_socket_shutdown(
soap->
ssl);
6676 gsk_secure_socket_close(&
soap->
ssl);
6696 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Close socket=%d\n", (
int)sk));
6708 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Shutdown socket=%d how=%d\n", (
int)sk, how));
6709 return shutdown(sk, how);
6721 #if defined(WITH_IPV6)
6722 struct addrinfo *addrinfo =
NULL;
6723 struct addrinfo hints;
6724 struct addrinfo res;
6728 #elif !defined(WITH_LEAN)
6745 memset((
void*)&hints, 0,
sizeof(hints));
6749 hints.ai_socktype = SOCK_DGRAM;
6752 hints.ai_socktype = SOCK_STREAM;
6753 hints.ai_flags = AI_PASSIVE;
6755 err = getaddrinfo(host,
soap_int2s(
soap, port), &hints, &addrinfo);
6756 if (err || !addrinfo)
6760 freeaddrinfo(addrinfo);
6766 freeaddrinfo(addrinfo);
6773 freeaddrinfo(addrinfo);
6774 soap->
master = (int)socket(res.ai_family, res.ai_socktype, res.ai_protocol);
6778 soap->
master = (
int)socket(AF_INET, SOCK_DGRAM, 0);
6781 soap->
master = (int)socket(AF_INET, SOCK_STREAM, 0);
6795 #ifdef WITH_SOCKET_CLOSE_ON_EXIT
6842 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"setsockopt TCP_FASTOPEN failed in soap_bind()\n"));
6848 if (res.ai_family == AF_INET6 && setsockopt(
soap->
master, IPPROTO_IPV6, IPV6_V6ONLY,
soap->
bind_v6only ? (
char*)&
set : (
char*)&unset,
sizeof(
int)))
6855 if (bind(
soap->
master, res.ai_addr, (
int)res.ai_addrlen))
6858 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not bind to host, bind failed\n"));
6877 soap->
peer.
in.sin_addr.s_addr = htonl(INADDR_ANY);
6883 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not bind to host, bind failed\n"));
6892 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not bind to host, listen failed\n"));
6934 || SSL_peek(
soap->
ssl, (
char*)&t, 1) > 0))
6943 || recv(
soap->
socket, (
char*)&t, 1, MSG_PEEK) > 0))
6953 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"soap_poll: other end down on socket=%d select=%d\n", (
int)
soap->
socket, r));
6985 if (SSL_peek(
soap->
ssl, &t, 1) > 0)
6995 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"soap_ready: other end not ready to send on socket=%d select=%d\n", (
int)
soap->
socket, r));
7066 struct addrinfo *res =
NULL;
7067 struct addrinfo hints;
7068 memset(&hints, 0,
sizeof(
struct addrinfo));
7069 hints.ai_family = PF_UNSPEC;
7070 hints.ai_socktype = SOCK_STREAM;
7071 hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV;
7078 if (getaddrinfo(
soap->
host,
NULL, &hints, &res) == 0 && res)
7080 struct sockaddr_storage
result;
7084 if (
result.ss_family == AF_INET6)
7086 struct sockaddr_in6 *addr = (
struct sockaddr_in6*)&
result;
7087 struct in6_addr *inaddr = &addr->sin6_addr;
7089 for (i = 0; i < 16; i++)
7092 else if (
result.ss_family == AF_INET)
7094 struct sockaddr_in *addr = (
struct sockaddr_in*)&
result;
7095 soap->
ip = ntohl(addr->sin_addr.s_addr);
7114 struct linger linger;
7115 memset((
void*)&linger, 0,
sizeof(linger));
7118 if (setsockopt(
soap->
socket, SOL_SOCKET, SO_LINGER, (
char*)&linger,
sizeof(
struct linger)))
7156 if (setsockopt(
soap->
socket, IPPROTO_TCP, TCP_NODELAY, (
char*)&
set,
sizeof(
int)))
7197 if (status && status < 200)
7246 #ifdef WITH_SELF_PIPE
7250 soap_close_connection(
struct soap *
soap)
7291 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Warning: managed C++ data was not deallocated with soap_destroy() from the heap managed by context %p\n", (
void*)
soap));
7293 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Warning: managed C data was not deallocated with soap_end() from the heap managed by context %p\n", (
void*)
soap));
7309 soap_free_cookies(
soap);
7404 # if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
7406 # elif OPENSSL_VERSION_NUMBER >= 0x10000000L
7407 ERR_remove_thread_state(
NULL);
7409 ERR_remove_state(0);
7417 gnutls_certificate_free_credentials(
soap->xcred);
7422 gnutls_anon_free_client_credentials(
soap->acred);
7427 gnutls_priority_deinit(
soap->cache);
7435 # if GNUTLS_VERSION_NUMBER < 0x030300
7449 #ifdef WITH_SYSTEMSSL
7451 gsk_secure_socket_close(&
soap->
ssl);
7454 gsk_environment_close(&
soap->
ctx);
7456 #ifdef WITH_C_LOCALE
7457 SOAP_FREELOCALE(
soap);
7472 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Free logfiles\n"));
7475 soap_close_logfile(
soap, i);
7483 #ifdef WITH_SELF_PIPE
7487 #ifdef SOAP_MEM_DEBUG
7488 soap_free_mht(
soap);
7505 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Waiting for HTTP request/response...\n"));
7552 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"EOF in HTTP header, try to continue anyway\n"));
7559 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"HTTP header: %s\n", header));
7560 s = strchr(header,
':');
7568 }
while (*s && *s <= 32);
7571 t = s + strlen(s) - 1;
7572 while (t > s && *t <= 32)
7574 if (t >= s && *t ==
'"')
7588 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Finished HTTP header parsing, status = %d\n",
soap->
status));
7590 if (s && s[5] ==
'1' && s[6] ==
'.' && s[7] ==
'0')
7610 else if (!strncmp(
soap->
msgbuf,
"DELETE ",
l = 7))
7614 else if (!strncmp(
soap->
msgbuf,
"OPTIONS ",
l = 8))
7672 #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS)
7696 if (
type && !strcmp(
type,
"application/xop+xml"))
7759 #if !defined(WITH_LEAN) || defined(WITH_NTLM)
7831 else if (!
soap_tag_cmp(key,
"Access-Control-Request-Method"))
7835 else if (!
soap_tag_cmp(key,
"Access-Control-Request-Headers"))
7845 soap_getcookies(
soap, val);
7854 #if !defined(WITH_NOHTTP) || !defined(WITH_LEANER)
7860 const char *s = line;
7879 #if !defined(WITH_NOHTTP) || !defined(WITH_LEANER)
7891 #if !defined(WITH_NOHTTP) || !defined(WITH_LEANER)
7908 #if !defined(WITH_NOHTTP) || !defined(WITH_LEANER)
7915 for (s = val; *s; s++)
7916 if (*s !=
' ' && *s !=
'\t' && !strchr(sep, *s))
7923 while (*s && *s !=
'"' && --i)
7928 while (*s && !strchr(sep, *s) && --i)
7930 if (*s ==
'%' && s[1] && s[2])
7932 *t++ = ((s[1] >=
'A' ? (s[1] & 0x7) + 9 : s[1] -
'0') << 4)
7933 + (s[2] >=
'A' ? (s[2] & 0x7) + 9 : s[2] -
'0');
7940 buf[len - 1] =
'\0';
7943 while (*s && !strchr(sep, *s))
7974 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"HTTP GET request\n"));
8061 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"HTTP %s to %s\n", s, endpoint ? endpoint :
"(null)"));
8084 if (*host !=
'[' && strchr(host,
':'))
8093 if (*host !=
'[' && strchr(host,
':'))
8129 err =
soap->
fposthdr(
soap,
"Accept",
"multipart/related,application/xop+xml,*/*;q=0.8");
8143 #if !defined(WITH_LEAN) || defined(WITH_NTLM)
8203 if (soap_putcookies(
soap, host, path, 0))
8227 t = strchr(s,
'\n');
8267 httpOutputEnable(
soap->rpmreqid);
8295 else if (!status || status ==
SOAP_HTML)
8302 else if (status < 200 || status >= 600)
8307 else if (
soap->
version == 2 && (!s || !strcmp(s,
"SOAP-ENV:Sender")))
8313 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"HTTP Status = %d %s\n",
code, line));
8326 else if ((status >= 301 && status <= 303) || status == 307)
8370 if (soap_putsetcookies(
soap))
8372 soap_free_cookies(
soap);
8431 if (t && (*t ==
'/' || *t ==
'?'))
8480 size_t n = strlen(s);
8484 size_t k = n - (s[n-1] ==
'=');
8485 while ((r = strchr(r,
'{')) !=
NULL)
8486 if (!strncmp(++r, s, k) && r[k] ==
'}')
8490 size_t m = t ? strlen(t) : 0;
8519 while ((
c = *s++) && --n > 0)
8523 || (
c >=
'0' &&
c <=
'9')
8524 || (
c >=
'A' &&
c <=
'Z')
8526 || (
c >=
'a' &&
c <=
'z')
8534 *t++ = (
c >> 4) + (
c > 159 ?
'7' :
'0');
8536 *t++ =
c + (
c > 9 ?
'7' :
'0');
8558 int n = 3 * (int)strlen(s) + 1;
8599 else if (*
path ==
'/')
8629 else if (*
path ==
'/')
8638 size_t l = strlen(
name) + 1;
8653 if (!strcmp((*p)->name,
name) && (*p)->path &&
path && strcmp((*p)->path,
path) < 0)
8685 size_t l = strlen(
value) + 1;
8702 size_t l = strlen(
domain) + 1;
8719 size_t l = strlen(
path) + 1;
8744 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Error in clear cookie='%s': cookie domain not set\n",
name ?
name :
"(null)"));
8751 else if (*
path ==
'/')
8812 return (time_t)p->
expire;
8894 soap_putsetcookies(
struct soap *
soap)
8912 if (t && (
int)strlen(t) < 3968 - (
int)(s-tmp))
8920 if (t && (
int)strlen(t) < 3976 - (
int)(s-tmp))
8936 if (p->
version > 0 && s-tmp < 3983)
8941 if (p->
maxage >= 0 && s-tmp < 4012)
8946 #if !defined(WITH_LEAN)
8947 #if defined(HAVE_GMTIME_R) || defined(HAVE_GMTIME)
8948 if (p->
maxage >= 0 && s-tmp < 4041)
8951 struct tm T, *pT = &T;
8954 #if defined(HAVE_GMTIME_R)
8956 l =
strftime(s, 4096 - (s-tmp),
";Expires=%a, %d %b %Y %H:%M:%S GMT", pT);
8960 l =
strftime(s, 4096 - (s-tmp),
";Expires=%a, %d %b %Y %H:%M:%S GMT", pT);
8978 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Set-Cookie: %s\n", tmp));
8992 soap_putcookies(
struct soap *
soap,
const char *domain,
const char *path,
int secure)
8997 time_t now = time(
NULL);
9002 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Sending cookies for domain='%s' path='%s'\n",
domain,
path));
9009 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Cookie %s expired\n", q->
name));
9031 const char *r = strchr(t,
':');
9036 flag = !strncmp(t,
domain, n);
9042 struct hostent hostent;
9045 const char *r = hostent.h_name;
9048 size_t k = strlen(hostent.h_name);
9050 r = hostent.h_name + k - n;
9052 flag = !strncmp(t, r, n);
9053 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Domain cookie %s host %s (match=%d)\n", t, r, flag));
9058 && (!q->
path || !strncmp(q->
path, path, strlen(q->
path)))
9059 #ifndef WITH_INSECURE_COOKIES
9060 && (!q->
secure || secure)
9066 n += 3*strlen(q->
name);
9068 n += 3*strlen(q->
value) + 1;
9070 n += strlen(q->
path) + 9;
9072 n += strlen(q->
domain) + 11;
9073 if (s + n >= tmp +
sizeof(tmp))
9078 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Cookie: %s\n", tmp));
9095 if (q->
name && (s-tmp) + strlen(q->
name) + (
size_t)15 <
sizeof(tmp))
9099 if (q->
value && *q->
value && (s-tmp) + strlen(q->
value) + (
size_t)16 <
sizeof(tmp))
9104 if (q->
path && (s-tmp) + strlen(q->
path) + (
size_t)36 <
sizeof(tmp))
9109 if (q->
domain && (s-tmp) + strlen(q->
domain) + (
size_t)36 <
sizeof(tmp))
9132 soap_getcookies(
struct soap *
soap,
const char *val)
9140 time_t now = time(
NULL);
9164 size_t l = strlen(tmp) + 1;
9189 size_t l = strlen(tmp) + 1;
9216 size_t l = strlen(tmp) + 1;
9231 size_t l = strlen(tmp) + 1;
9253 if (!p->
expire && strlen(tmp) >= 23)
9257 static const char mns[] =
"anebarprayunulugepctovec";
9258 const char *t = strchr(tmp,
' ');
9262 memset((
void*)&T, 0,
sizeof(T));
9268 T.tm_mon = (int)(strstr(mns,
a) - mns) / 2;
9272 if (t[17] && t[18] && t[19] !=
' ')
9287 T.tm_mon = (int)(strstr(mns,
a) - mns) / 2;
9348 size_t l = strlen(tmp) + 1;
9358 l = strlen(tmp) + 1;
9431 soap_getenv_cookies(
struct soap *
soap)
9435 char key[4096], val[4096];
9436 s = getenv(
"HTTP_COOKIE");
9468 size_t l = strlen(p->
name) + 1;
9477 size_t l = strlen(p->
value) + 1;
9486 size_t l = strlen(p->
domain) + 1;
9487 (*q)->domain =
NULL;
9495 size_t l = strlen(p->
path) + 1;
9513 soap_free_cookies(
struct soap *
soap)
9543 h = *s++ + (h << 6) + (h << 16) - h;
9609 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Free pointer hashtable\n"));
9623 #ifndef WITH_NOIDREF
9665 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Lookup location=%p type=%d id=%d\n", p,
type, pp->
id));
9670 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Lookup location=%p type=%d: not found\n", p,
type));
9701 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Pointer enter location=%p array=%p size=%lu type=%d id=%d\n", p,
a, (
unsigned long)n,
type,
soap->
idnum+1));
9731 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Array lookup location=%p type=%d id=%d\n",
a,
type, pp->
id));
9735 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Array lookup location=%p type=%d: not found\n",
a,
type));
9826 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"End of count phase\n"));
9869 #if !defined(__cplusplus) || defined(WITH_COMPAT)
9903 #ifndef WITH_FASTCGI
9971 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Deflate initialized\n"));
10009 #ifndef WITH_NOIDREF
10020 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Embedded %p type=%d mark set to 1\n", p, t));
10027 #ifndef WITH_NOIDREF
10038 if (pp->
mark1 == 0)
10048 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Reference %p type=%d (%d %d)\n", p, t, (
int)pp->
mark1, (
int)pp->
mark2));
10055 #ifndef WITH_NOIDREF
10066 if (pp->
mark1 == 0)
10076 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Array reference %p ptr=%p n=%lu t=%d (%d %d)\n", p,
a, (
unsigned long)n, t, (
int)pp->
mark1, (
int)pp->
mark2));
10083 #ifndef WITH_NOIDREF
10094 if (pp->
mark1 == 0)
10106 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Attachment reference %p ptr=%p n=%lu t=%d (%d %d)\n", p,
a, (
unsigned long)n, t, (
int)pp->
mark1, (
int)pp->
mark2));
10113 #ifndef WITH_NOIDREF
10122 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Embedded_id %p type=%d id=%d\n", p, t,
id));
10136 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Embedded_id multiref id=%d %p type=%d = (%d %d)\n",
id, p, t, (
int)pp->
mark1, (
int)pp->
mark2));
10146 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Embedded_id embedded ref id=%d %p type=%d = (%d %d)\n",
id, p, t, (
int)pp->
mark1, (
int)pp->
mark2));
10155 #ifndef WITH_NOIDREF
10167 return pp->
mark1 != 0;
10168 return pp->
mark2 != 0;
10171 return pp->
mark1 == 1;
10172 return pp->
mark2 == 1;
10178 #ifndef WITH_NOIDREF
10189 return pp->
mark1 == 0;
10190 return pp->
mark2 == 0;
10196 #ifndef WITH_NOIDREF
10213 #ifndef WITH_LEANER
10217 soap_attachment(
struct soap *
soap,
const char *tag,
int id,
const void *p,
const void *
a,
int n,
const char *aid,
const char *atype,
const char *aoptions,
const char *
type,
int t)
10248 ||
soap_element_href(
soap,
"xop:Include", 0,
"xmlns:xop=\"http://www.w3.org/2004/08/xop/include\" href", aid)
10258 if (pp->
mark1 != 3)
10270 if (!strncmp(aid,
"cid:", 4))
10274 size_t l = strlen(aid) - 1;
10287 content->
id = aid + 4;
10294 content->
type = atype;
10310 #ifndef WITH_NOIDREF
10322 #ifndef WITH_NOIDREF
10329 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Free ID hashtable\n"));
10332 for (ip =
soap->
iht[i]; ip; ip = p)
10334 for (fp = ip->
flist; fp; fp = fq)
10349 #ifndef WITH_NOIDREF
10357 if (!strcmp(ip->
id,
id))
10365 #ifndef WITH_NOIDREF
10373 size_t l = strlen(
id);
10412 n +=
sizeof(short);
10413 n += (~n+1) & (
sizeof(
void*)-1);
10414 if (n +
sizeof(
void*) +
sizeof(size_t) < k)
10426 *(
unsigned short*)(p + n -
sizeof(
unsigned short)) = (
unsigned short)
SOAP_CANARY;
10429 *(
size_t*)(p + n +
sizeof(
void*)) = n;
10436 #ifdef SOAP_MEM_DEBUG
10448 #ifdef SOAP_MEM_DEBUG
10453 struct soap_mlist *mp, *mq;
10456 for (mp =
soap->
mht[i]; mp; mp = mq)
10460 fprintf(stderr,
"%s(%d): malloc() = %p not freed (memory leak or forgot to call soap_end()?)\n", mp->file, mp->line, mp->ptr);
10470 #ifdef SOAP_MEM_DEBUG
10476 void *p = malloc(size);
10480 struct soap_mlist *mp = (
struct soap_mlist*)malloc(
sizeof(
struct soap_mlist));
10483 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"%s(%d): malloc(%lu) = %p\n",
file, line, (
unsigned long)size, p));
10498 #ifdef SOAP_MEM_DEBUG
10511 struct soap_mlist *mp;
10512 for (mp =
soap->
mht[h]; mp; mp = mp->next)
10521 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"%s(%d): free(%p)\n",
file, line, p));
10528 fprintf(stderr,
"%s(%d): free(%p) double free of pointer malloced at %s(%d)\n",
file, line, p, mp->file, mp->line);
10533 fprintf(stderr,
"%s(%d): free(%p) pointer not malloced\n",
file, line, p);
10541 #ifdef SOAP_MEM_DEBUG
10543 soap_track_unlink(
struct soap *
soap,
const void *p)
10546 struct soap_mlist *mp;
10547 for (mp =
soap->
mht[h]; mp; mp = mp->next)
10567 for (q = (
char**)(
void*)&
soap->
alist; *q; q = *(
char***)q)
10569 if (*(
unsigned short*)(
char*)(*q -
sizeof(
unsigned short)) != (
unsigned short)
SOAP_CANARY)
10571 #ifdef SOAP_MEM_DEBUG
10572 fprintf(stderr,
"Data corruption in dynamic allocation (see logs)\n");
10574 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Data corruption:\n"));
10580 if (p == (
void*)(*q - *(
size_t*)(*q +
sizeof(
void*))))
10583 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Freed data at %p\n", p));
10593 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Free all soap_malloc() data\n"));
10597 if (*(
unsigned short*)(
char*)(q -
sizeof(
unsigned short)) != (
unsigned short)
SOAP_CANARY)
10599 #ifdef SOAP_MEM_DEBUG
10600 fprintf(stderr,
"Data corruption in dynamic allocation (see logs)\n");
10602 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Data corruption:\n"));
10609 q -= *(
size_t*)(q +
sizeof(
void*));
10624 #ifndef WITH_LEANER
10645 if (p == (*cp)->ptr)
10651 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not dealloc data %p: deletion callback failed for object type=%d\n", q->
ptr, q->
type));
10652 #ifdef SOAP_MEM_DEBUG
10653 fprintf(stderr,
"new(object type=%d) = %p not freed: deletion callback failed\n", q->
type, q->
ptr);
10661 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not dealloc data %p: address not in list\n", p));
10669 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Delete %p type=%d (cp=%p)\n", q->
ptr, q->
type, (
void*)q));
10672 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not dealloc data %p: deletion callback failed for object type=%d\n", q->
ptr, q->
type));
10673 #ifdef SOAP_MEM_DEBUG
10674 fprintf(stderr,
"new(object type=%d) = %p not freed: deletion callback failed\n", q->
type, q->
ptr);
10693 #ifdef SOAP_MEM_DEBUG
10695 struct soap_mlist **mp, *mq;
10698 for (q = (
char**)(
void*)&
soap->
alist; *q; q = *(
char***)q)
10700 if (*(
unsigned short*)(
char*)(*q -
sizeof(
unsigned short)) != (
unsigned short)
SOAP_CANARY)
10702 #ifdef SOAP_MEM_DEBUG
10703 fprintf(stderr,
"Data corruption in dynamic allocation (see logs)\n");
10705 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Data corruption:\n"));
10711 #ifdef SOAP_MEM_DEBUG
10712 p = (
void*)(*q - *(
size_t*)(*q +
sizeof(
void*)));
10714 for (mp = &
soap->
mht[h]; *mp; mp = &(*mp)->next)
10716 if ((*mp)->ptr == p)
10720 mq->next = soap_to->
mht[h];
10721 soap_to->
mht[h] = mq;
10727 *q = (
char*)soap_to->
alist;
10730 #ifdef SOAP_MEM_DEBUG
10735 for (mp = &
soap->
mht[h]; *mp; mp = &(*mp)->next)
10737 if ((*mp)->ptr == cp)
10741 mq->next = soap_to->
mht[h];
10742 soap_to->
mht[h] = mq;
10749 cp = soap_to->
clist;
10806 for (q = (
char**)(
void*)&
soap->
alist; *q; q = *(
char***)q)
10808 if (p == (
void*)(*q - *(
size_t*)(*q +
sizeof(
void*))))
10811 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Unlinked data %p\n", p));
10812 #ifdef SOAP_MEM_DEBUG
10813 soap_track_unlink(
soap, p);
10820 if (p == (*cp)->ptr)
10822 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Unlinked class instance %p\n", p));
10835 #ifndef WITH_NOIDREF
10847 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Lookup id='%s' type=%d\n",
id, ip->
type));
10851 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"lookup type id='%s' NOT FOUND! Need to get it from xsi:type\n",
id));
10858 #ifndef WITH_NOIDREF
10872 #ifndef WITH_NOIDREF
10884 #ifndef WITH_NOIDREF
10891 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Shaky %p\n", p));
10898 #ifndef WITH_NOIDREF
10905 if (!p || !
id || !*
id)
10913 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Forwarding first href='%s' type=%d location=%p (%u bytes) level=%u\n",
id, t, (
void*)p, (
unsigned int)n, k));
10926 *p = &ip->
spine[k - 1];
10936 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Lookup type incompatibility: ref='%s' id-type=%d ref-type=%d\n",
id, ip->
type, t));
10940 else if (k == 0 && ip->
ptr && !ip->
shaky)
10942 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Resolved href='%s' type=%d location=%p (%u bytes) level=%u\n",
id, t, ip->
ptr, (
unsigned int)n, k));
10947 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Forwarded href='%s' type=%d location=%p (%u bytes) level=%u\n",
id, t, (
void*)p, (
unsigned int)n, k));
10968 *p = &ip->
spine[k - 1];
10974 void *q = ip->
link;
10986 #ifndef WITH_NOIDREF
10990 soap_id_forward(
struct soap *
soap,
const char *href,
void *p,
size_t i,
int t,
int tt,
size_t n,
unsigned int k,
void (*finsert)(
struct soap*,
int,
int,
void*,
size_t,
const void*,
void**),
int (*fbase)(
int,
int))
10993 if (!p || !href || !*href)
11001 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"New entry href='%s' type=%d size=%lu level=%d location=%p\n", href, t, (
unsigned long)n, k, p));
11003 else if ((ip->
type != t || ip->
size != n) && k == 0)
11005 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Forward type incompatibility id='%s' expect type=%d size=%lu level=%u got type=%d size=%lu\n", href, ip->
type, (
unsigned long)ip->
size, k, t, (
unsigned long)n));
11009 if (finsert || n <
sizeof(
void*))
11022 if ((ip->
type != t || ip->
size != n) && (!fbase || !fbase(ip->
type, t)))
11024 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Forward type incompatibility id='%s' expect type=%d size=%lu level=%u got type=%d size=%lu\n", href, ip->
type, (
unsigned long)ip->
size, k, t, (
unsigned long)n));
11036 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Forwarding type=%d (target type=%d) size=%lu location=%p level=%u index=%lu href='%s'\n", t, tt, (
unsigned long)n, p, k, (
unsigned long)i, href));
11040 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Forwarding copying address %p for type=%d href='%s'\n", p, t, href));
11041 *(
void**)p = ip->
copy;
11054 soap_id_enter(
struct soap *
soap,
const char *
id,
void *p,
int t,
size_t n,
const char *
type,
const char *arrayType,
void *(*finstantiate)(
struct soap*,
int,
const char*,
const char*,
size_t*),
int (*fbase)(
int,
int))
11056 #ifndef WITH_NOIDREF
11059 (void)
id; (void)fbase;
11060 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Enter id='%s' type=%d location=%p size=%lu\n",
id, t, p, (
unsigned long)n));
11066 p = finstantiate(
soap, t,
type, arrayType, &n);
11075 #ifndef WITH_NOIDREF
11079 #ifndef WITH_NOIDREF
11081 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Lookup entry id='%s' for location=%p type=%d\n",
id, p, t));
11088 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"New entry id='%s' type=%d size=%lu location=%p\n",
id, t, (
unsigned long)n, p));
11094 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Multiply defined id='%s'\n",
id));
11102 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Enter type incompatibility id='%s' expect type=%d size=%lu got type=%d size=%lu\n",
id, ip->
type, (
unsigned long)ip->
size, t, (
unsigned long)n));
11118 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Traversing link chain to resolve id='%s' type=%d\n", ip->
id, ip->
type));
11119 q = (
void**)ip->
link;
11124 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"... link %p -> %p\n", (
void*)q, p));
11141 (void)
soap; (void)
id; (void)t; (void)n;
11142 #ifndef WITH_NOIDREF
11152 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"New smart shared pointer entry id='%s' type=%d size=%lu smart=%p\n",
id, t, (
unsigned long)n, ip->
smart));
11161 #ifndef WITH_NOIDREF
11169 for (fp = ip->
flist; fp; fp = fp->
next)
11170 if (fp->
level == 0)
11178 #ifndef WITH_NOIDREF
11191 for (p = ip->
link; p; p = q)
11211 #ifndef WITH_LEANER
11268 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Deflating remainder\n"));
11281 }
while (r ==
Z_OK);
11311 #if !defined(__cplusplus) || defined(WITH_COMPAT)
11325 #ifndef WITH_NOHTTP
11329 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Sending buffered message of length %u\n", (
unsigned int)
soap->
blist->
size));
11352 #ifndef WITH_LEANER
11359 #ifndef WITH_LEANER
11362 DBGMSG(SENT,
"\r\n0\r\n\r\n", 7);
11371 #if defined(WITH_OPENSSL) || defined(WITH_SYSTEMSSL)
11377 #if defined(__cplusplus) && !defined(WITH_COMPAT)
11381 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"End of send phase\n"));
11401 #ifndef WITH_LEANER
11417 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Post checking MIME attachments\n"));
11420 #ifndef WITH_NOIDREF
11439 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"End of receive message ok\n"));
11454 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Inflate end ok\n"));
11460 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Inflate gzip crc check\n"));
11461 for (i = 0; i < 8; i++)
11465 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Gzip error: unable to read crc value\n"));
11472 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Gzip inflate error: crc check failed, message corrupted? (crc32=%lu)\n", (
unsigned long)
soap->
z_crc));
11477 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Gzip inflate error: incorrect message length\n"));
11488 #ifndef WITH_NOIDREF
11492 #ifndef WITH_LEANER
11501 #ifndef WITH_LEANER
11518 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Free any remaining temp blocks\n"));
11521 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Free attribute storage\n"));
11540 for (;
ns->id;
ns++)
11551 #ifndef WITH_LEANER
11559 #ifndef WITH_NOIDREF
11571 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Free namespace stack\n"));
11612 soap_close_logfile(
struct soap *
soap,
int i)
11632 soap_close_logfile(
soap, i);
11640 soap_set_logfile(
struct soap *
soap,
int i,
const char *logfile)
11644 soap_close_logfile(
soap, i);
11650 size_t l = strlen(logfile) + 1;
11666 (void)
soap; (void)logfile;
11679 (void)
soap; (void)logfile;
11692 (void)
soap; (void)logfile;
11732 #ifdef SOAP_MEM_DEBUG
11733 soap_init_mht(
copy);
11736 soap_init_logs(
copy);
11762 #ifdef WITH_OPENSSL
11766 copy->session_host[0] =
'\0';
11767 copy->session_port = 443;
11776 #ifndef WITH_NOIDREF
11784 #ifdef WITH_COOKIES
11796 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not allocate plugin '%s'\n", p->
id));
11801 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Copying plugin '%s'\n", p->
id));
11805 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not copy plugin '%s' error = %d\n", p->
id,
copy->error));
11815 #ifdef WITH_SELF_PIPE
11816 pipe(
copy->pipe_fd);
11887 #ifdef WITH_OPENSSL
11895 #ifdef WITH_SYSTEMSSL
11905 if (!
copy->d_stream)
11907 if (
copy->d_stream)
11921 copy->z_buflen = 0;
11926 copy->z_buflen = 0;
11943 size_t n =
sizeof(
struct soap_nlist) + strlen(nq->
id);
11950 (void)
soap_memcpy((
void*)np, n, (
const void*)nq, n);
11955 const char *s = np->
ns;
11957 if (!s && np->
index >= 0)
11988 (void)
soap_memcpy((
void*)tp, n, (
const void*)tq, n);
11993 (void)
soap_memcpy((
void*)tp->value, tp->size, (
const void*)tq->
value, tp->size);
11998 copy->attributes = tp;
12011 #ifdef WITH_OPENSSL
12024 #ifdef WITH_SYSTEMSSL
12054 #ifdef SOAP_MEM_DEBUG
12055 soap_init_mht(
soap);
12058 soap_init_logs(
soap);
12060 #ifdef TANDEM_NONSTOP
12069 #ifdef WITH_SELF_PIPE
12070 pipe(
soap->pipe_fd);
12089 #ifndef WITH_NOHTTP
12136 #ifndef WITH_LEANER
12178 #ifdef WITH_IPV6_V6ONLY
12218 #ifndef WITH_NONAMESPACES
12238 #ifndef WITH_LEANER
12284 soap->
prolog =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
12305 #ifndef WITH_NOIDREF
12309 #ifdef WITH_OPENSSL
12310 if (!soap_ssl_init_done)
12331 if (!soap_ssl_init_done)
12349 #ifdef WITH_SYSTEMSSL
12369 #ifndef WITH_LEANER
12481 const char *
ns = p[0].
out;
12542 if (!s && np->
index >= 0 &&
ns)
12557 for (i = 0;
ns[i].id; i++)
12598 for (; ns2->
id; ns2++)
12614 size_t n = strlen(little);
12615 const char *s = big;
12620 for (i = 0; i < n; i++, t++)
12622 if (*t != little[i])
12625 if (*t ==
'\0' || *t ==
' ')
12627 if (i == n || (i > 0 && little[i-1] ==
':'))
12630 s = strchr(t,
' ');
12648 if (!strncmp(np->
id, tag, n) && !np->
id[n])
12668 if (!strcmp(np->
id,
id) && ((!np->
ns && *
id) || (np->
ns && !strcmp(np->
ns,
ns))))
12687 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Adding namespace binding (level=%u) '%s' '%s' utilized=%d\n",
level,
id,
ns ?
ns :
"(null)", utilized));
12690 k = strlen(
ns) + 1;
12705 np->
ns = np->
id + n + 1;
12713 np->
index = utilized;
12726 if (!strncmp(tag,
"xmlns:", 6))
12733 const char *t = strchr(tag,
':');
12740 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Utilizing namespace '%s' of '%s' at level %u utilized=%d at level=%u\n", np->
ns ? np->
ns :
"", tag,
soap->
level + isearly, np->
index, np->
level));
12741 if (np->
index <= 0)
12749 else if (strncmp(tag,
"xml", 3))
12751 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Utilizing default namespace of '%s' at level %u\n", tag,
soap->
level + isearly));
12774 for (s = tag, i = 0; *s && i <
sizeof(
soap->
href) - 1; s++, i++)
12775 soap->
href[i] = *s ==
':' ?
'-' : *s;
12798 if (np->
index == 2 || p)
12864 s = strchr(tag,
':');
12875 for (;
ns &&
ns->id;
ns++)
12877 if (*
ns->id &&
ns->ns && !strncmp(
ns->id, tag, n) && !
ns->id[n])
12889 #ifndef WITH_NOEMPTYNAMESPACES
12912 while (k-- &&
ns->id)
12914 const char *t =
ns->out;
12917 if (*
ns->id && t && *t)
13028 #if _MSC_VER < 1400 && !defined(HAVE_STRLCAT)
13035 size_t k = strlen(t);
13040 while (--n > 0 && *s)
13049 #if _MSC_VER < 1400
13064 while (--n > 0 && *s)
13073 #ifndef HAVE_STRRCHR
13089 #ifndef HAVE_STRTOL
13097 while (*s > 0 && *s <= 32)
13107 else if (*s ==
'+')
13111 while ((
c = *s) &&
c >=
'0' &&
c <=
'9')
13113 if (n >= 214748364 && (n > 214748364 ||
c >=
'8'))
13115 if (neg && n == 214748364 &&
c ==
'8')
13118 *t = (
char*)(s + 1);
13119 return -2147483648;
13134 if (
c >=
'0' &&
c <=
'9')
13136 else if (
c >=
'A' &&
c <=
'F')
13138 else if (
c >=
'a' &&
c <=
'f')
13140 if (n > 0x07FFFFFF)
13155 #ifndef HAVE_STRTOUL
13161 unsigned long n = 0;
13163 while (*s > 0 && *s <= 32)
13173 else if (*s ==
'+')
13177 while ((
c = *s) &&
c >=
'0' &&
c <=
'9')
13179 if (n >= 429496729 && (n > 429496729 ||
c >=
'6'))
13192 if (
c >=
'0' &&
c <=
'9')
13194 else if (
c >=
'A' &&
c <=
'F')
13196 else if (
c >=
'a' &&
c <=
'f')
13198 if (n > 0x0FFFFFFF)
13213 #ifndef soap_strtoll
13221 while (*s > 0 && *s <= 32)
13231 else if (*s ==
'+')
13235 while ((
c = *s) &&
c >=
'0' &&
c <=
'9')
13237 if (n >= 922337203685477580LL && (n > 922337203685477580LL ||
c >=
'8'))
13239 if (neg && n == 922337203685477580LL &&
c ==
'8')
13242 *t = (
char*)(s + 1);
13243 return -9223372036854775807LL - 1LL;
13258 if (
c >=
'0' &&
c <=
'9')
13260 else if (
c >=
'A' &&
c <=
'F')
13262 else if (
c >=
'a' &&
c <=
'f')
13264 if (n > 0x07FFFFFFFFFFFFFFLL)
13279 #ifndef soap_strtoull
13287 while (*s > 0 && *s <= 32)
13297 else if (*s ==
'+')
13301 while ((
c = *s) &&
c >=
'0' &&
c <=
'9')
13303 if (n >= 1844674407370955161ULL && (n > 1844674407370955161ULL ||
c >=
'6'))
13309 if (neg && n > 0UL)
13316 if (
c >=
'0' &&
c <=
'9')
13318 else if (
c >=
'A' &&
c <=
'F')
13320 else if (
c >=
'a' &&
c <=
'f')
13322 if (n > 0x0FFFFFFFFFFFFFFFULL)
13356 s = strchr(
type,
'[');
13363 if (*s && *s !=
']')
13406 if (np->
ns && np->
index == 1)
13422 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Binding (level=%u) %s='%s' utilized=%d\n", np->
level, np->
id, np->
ns, np->
index));
13439 (*att)->next =
NULL;
13440 (*att)->nstr =
NULL;
13443 (*att)->soap =
soap;
13444 if (!(*att)->name || (tp->
value && !(*att)->text))
13446 att = &(*att)->
next;
13520 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Element ending tag='%s'\n", tag));
13558 const char *s =
"ref";
13567 s =
"SOAP-ENC:ref";
13580 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Element '%s' reference %s='%s'\n", tag, ref, val));
13655 #ifndef WITH_NOIDREF
13656 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Element_id %p type=%d id=%d\n", p, t,
id));
13698 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Check %p and mark %p\n", p, (
void*)mark));
13707 *mark = &pp->
mark1;
13714 *mark = &pp->
mark2;
13731 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Mark lookup %p type=%d\n", p, t));
13739 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Mark found %p\n", (*ppp)->dup));
13740 return (*ppp)->dup;
13744 if ((*ppp)->mark1 > 0)
13748 *mark = &(*ppp)->mark1;
13749 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Mark cycle %d\n", (*ppp)->mark1));
13844 if (!
a->name || (
value && !
a->text))
13853 if (!strncmp(
name,
"xmlns", 5) && ((
name[5] ==
':') ||
name[5] ==
'\0'))
13856 if (
name[5] ==
'\0')
13895 if (tag && *tag ==
'-')
13932 if (tag && *tag ==
'-')
14047 else if (
flag >= 4)
14082 size_t l = strlen(
name);
14083 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Allocate attribute %s\n",
name));
14093 const char *s = strchr(
name,
':');
14094 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Inserting attribute %s for c14n\n",
name));
14095 if (!strncmp(
name,
"xmlns", 5))
14097 for (; *tpp; tpp = &(*tpp)->
next)
14098 if (strncmp((*tpp)->name,
"xmlns", 5) || strcmp((*tpp)->name + 5,
name + 5) > 0)
14103 for (; *tpp; tpp = &(*tpp)->
next)
14104 if (strncmp((*tpp)->name,
"xmlns", 5) && ((*tpp)->ns || strcmp((*tpp)->name,
name) > 0))
14126 for (; *tpp; tpp = &(*tpp)->
next)
14129 if (strncmp((*tpp)->name,
"xmlns", 5) && (*tpp)->ns && tp->
ns && ((k = strcmp((*tpp)->ns, tp->
ns)) > 0 || (!k && strcmp((*tpp)->name,
name) > 0)))
14157 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Free attribute value of %s (free %p)\n",
name, (
void*)tp->
value));
14171 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Allocate attribute value for %s (%p)\n", tp->
name, (
void*)tp->
value));
14174 if (!strncmp(tp->
name,
"xmlns:", 6))
14179 if (!strcmp(
name,
"wsu:Id"))
14186 const char *s = strchr(
name,
':');
14187 if (s && strchr(
value,
':'))
14193 || ((!strcmp(s + 1,
"arrayType") || !strcmp(s + 1,
"itemType")) && !strcmp(np->
ns,
soap->
local_namespaces[1].
ns)))
14245 for (i = 0; i < k; i++)
14257 if ((
c & 0x80000000) &&
c >= -0x7FFFFF80 &&
c <
SOAP_AP)
14262 *t++ = (char)(0xC0 | ((
c >> 6) & 0x1F));
14265 #ifdef WITH_REPLACE_ILLEGAL_UTF8
14266 if (!((
c >= 0x80 &&
c <= 0xD7FF) || (
c >= 0xE000 &&
c <= 0xFFFD) || (
c >= 0x10000 &&
c <= 0x10FFFF)))
14267 c = SOAP_UNKNOWN_UNICODE_CHAR;
14271 *t++ = (char)(0xE0 | ((
c >> 12) & 0x0F));
14277 *t++ = (char)(0xF0 | ((
c >> 18) & 0x07));
14281 if (
c < 0x04000000)
14283 *t++ = (char)(0xF8 | ((
c >> 24) & 0x03));
14287 *t++ = (char)(0xFC | ((
c >> 30) & 0x01));
14288 *t++ = (char)(0x80 | ((
c >> 24) & 0x3F));
14290 *t++ = (char)(0x80 | ((
c >> 18) & 0x3F));
14292 *t++ = (char)(0x80 | ((
c >> 12) & 0x3F));
14294 *t++ = (char)(0x80 | ((
c >> 6) & 0x3F));
14296 *t++ = (char)(0x80 | (
c & 0x3F));
14403 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Enlarging look-aside buffer to append data, size=%lu\n", (
unsigned long)
soap->
lablen));
14412 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"New look-aside buffer size=%lu\n", (
unsigned long)
soap->
lablen));
14542 while (
c !=
'>' &&
c !=
'/' &&
c > 32 && (
int)
c != EOF)
14600 while ((
int)
c != EOF &&
c !=
'>' &&
c !=
'/')
14604 while (
c !=
'=' &&
c !=
'>' &&
c !=
'/' &&
c > 32 && (
int)
c != EOF)
14623 (*att)->next =
NULL;
14624 (*att)->nstr =
NULL;
14626 (*att)->text =
NULL;
14627 (*att)->soap =
soap;
14783 if (att && tp->
value)
14797 att = &(*att)->
next;
14799 if (t && tp->
value)
14834 #ifndef WITH_NOIDREF
14835 if (!strcmp(tp->
name,
"id"))
14844 else if (!strcmp(tp->
name,
"href"))
14851 else if (!strcmp(tp->
name,
"ref"))
14861 if (!strcmp(tp->
name,
"href"))
14873 && (!strcmp(tp->
value,
"1")
14874 || !strcmp(tp->
value,
"true")))
14910 && (!strcmp(tp->
value,
"1") || !strcmp(tp->
value,
"true")))
14917 && strcmp(tp->
value,
"http://schemas.xmlsoap.org/soap/actor/next"))
14923 #ifndef WITH_NOIDREF
14945 && (!strcmp(tp->
value,
"1") || !strcmp(tp->
value,
"true")))
14952 && strcmp(tp->
value,
"http://www.w3.org/2003/05/soap-envelope/role/next"))
15123 #ifndef WITH_LEANER
15128 int m = mbtowc(&wc, t - 1, MB_CUR_MAX);
15129 if (m > 0 && !((
soap_wchar)wc ==
c && m == 1 &&
c < 0x80))
15139 #ifndef WITH_NOSTRINGTOUTF8
15140 if ((
c & mask) || !(
c & 0xFFFFFFE0UL))
15163 int n = 0,
f = 0, m = 0;
15165 #if !defined(WITH_LEANER) && defined(HAVE_WCTOMB)
15166 char buf[MB_LEN_MAX > 8 ? MB_LEN_MAX : 8];
15170 if (maxlen < 0 && soap->maxlength > 0)
15172 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Reading string content, flag=%d\n",
flag));
15173 if (flag <= 0 && soap->peeked && *
soap->
tag)
15177 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"String content includes tag '%s' and attributes\n",
soap->
tag));
15186 size_t k = strlen(tp->
name);
15194 k = strlen(tp->
value);
15242 for (i = 0; i < k; i++)
15253 if ((
c >= 0x80 ||
c <
SOAP_AP) && state != 1)
15255 if ((
c & 0x7FFFFFFF) >= 0x80)
15265 *t++ = (char)(0xC0 | ((
c >> 6) & 0x1F));
15268 #ifdef WITH_REPLACE_ILLEGAL_UTF8
15269 if (!((
c >= 0x80 &&
c <= 0xD7FF) || (
c >= 0xE000 &&
c <= 0xFFFD) || (
c >= 0x10000 &&
c <= 0x10FFFF)))
15270 c = SOAP_UNKNOWN_UNICODE_CHAR;
15274 *t++ = (char)(0xE0 | ((
c >> 12) & 0x0F));
15280 *t++ = (char)(0xF0 | ((
c >> 18) & 0x07));
15284 if (
c < 0x04000000)
15286 *t++ = (char)(0xF8 | ((
c >> 24) & 0x03));
15290 *t++ = (char)(0xFC | ((
c >> 30) & 0x01));
15291 *t++ = (char)(0x80 | ((
c >> 24) & 0x3F));
15293 *t++ = (char)(0x80 | ((
c >> 18) & 0x3F));
15295 *t++ = (char)(0x80 | ((
c >> 12) & 0x3F));
15297 *t++ = (char)(0x80 | ((
c >> 6) & 0x3F));
15299 *t++ = (char)(0x80 | (
c & 0x3F));
15300 m = (int)(t - buf) - 1;
15373 if (
flag == 3 || (
f && n == 0))
15416 }
while ((
int)
c != EOF &&
c !=
'[');
15419 t = (
char*)
"![CDATA[";
15445 else if (
flag == 3 || (
f && n == 0))
15463 #ifndef WITH_LEANER
15467 #if defined(WIN32) && !defined(CYGWIN) && !defined(__MINGW32__) && !defined(__MINGW64__) && !defined(__BORLANDC__)
15469 wctomb_s(&m, buf,
sizeof(buf), (
wchar_t)(
c & 0x7FFFFFFF));
15471 m = wctomb(buf, (
wchar_t)(
c & 0x7FFFFFFF));
15473 if (m >= 1 && m <= (
int)MB_CUR_MAX)
15488 *s++ = (char)(
c & 0xFF);
15491 if (maxlen >= 0 &&
l > (
size_t)maxlen)
15493 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"String too long: maxlen=%ld\n", maxlen));
15522 for (i = 0; i < k; i++)
15539 if (
c >= 0x80 || (c < SOAP_AP && c >= -0x7FFFFF80))
15545 *t++ = (char)(0xC0 | ((
c >> 6) & 0x1F));
15549 #ifdef WITH_REPLACE_ILLEGAL_UTF8
15550 if (!((
c >= 0x80 &&
c <= 0xD7FF) || (
c >= 0xE000 &&
c <= 0xFFFD) || (
c >= 0x10000 &&
c <= 0x10FFFF)))
15551 c = SOAP_UNKNOWN_UNICODE_CHAR;
15555 *t++ = (char)(0xE0 | ((
c >> 12) & 0x0F));
15561 *t++ = (char)(0xF0 | ((
c >> 18) & 0x07));
15565 if (
c < 0x04000000)
15567 *t++ = (char)(0xF8 | ((
c >> 24) & 0x03));
15571 *t++ = (char)(0xFC | ((
c >> 30) & 0x01));
15572 *t++ = (char)(0x80 | ((
c >> 24) & 0x3F));
15574 *t++ = (char)(0x80 | ((
c >> 18) & 0x3F));
15576 *t++ = (char)(0x80 | ((
c >> 12) & 0x3F));
15578 *t++ = (char)(0x80 | ((
c >> 6) & 0x3F));
15580 *t++ = (char)(0x80 | (
c & 0x3F));
15581 m = (int)(t - buf) - 1;
15585 if (maxlen >= 0 &&
l > (
size_t)maxlen)
15587 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"String too long: maxlen=%ld\n", maxlen));
15606 if (
flag == 3 || (
f && n == 0))
15683 t = (
char*)
"quot;";
15695 t = (
char*)
"apos;";
15722 #ifndef WITH_LEANER
15726 #if defined(WIN32) && !defined(CYGWIN) && !defined(__MINGW32__) && !defined(__MINGW64__) && !defined(__BORLANDC__)
15728 wctomb_s(&m, buf,
sizeof(buf), (
wchar_t)(
c & 0x7FFFFFFF));
15730 m = wctomb(buf, (
wchar_t)(
c & 0x7FFFFFFF));
15732 if (m >= 1 && m <= (
int)MB_CUR_MAX)
15747 *s++ = (char)(
c & 0xFF);
15750 if (maxlen >= 0 &&
l > (
size_t)maxlen)
15752 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"String too long: maxlen=%ld\n", maxlen));
15769 if (minlen > 0 &&
l < (
size_t)minlen)
15771 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"String too short: %lu chars, minlen=%ld\n", (
unsigned long)
l, minlen));
15789 else if (
flag >= 4 && t)
15793 #ifndef WITH_LEANER
15806 #ifndef WITH_LEANER
15857 if (
c >= 0x20 &&
c < 0x80)
15866 if (
sizeof(
wchar_t) < 4 && (
c & 0xFC00) == 0xD800)
15869 if ((
d & 0xFC00) == 0xDC00)
15871 c = ((
c - 0xD800) << 10) + (
d - 0xDC00) + 0x10000;
15874 #ifdef WITH_REPLACE_ILLEGAL_UTF8
15877 c = SOAP_UNKNOWN_UNICODE_CHAR;
15895 #ifndef WITH_LEANER
15902 int i, n = 0,
f = 0;
15906 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Reading wide string content\n"));
15907 if (maxlen < 0 && soap->maxlength > 0)
15909 if (flag <= 0 && soap->peeked && *
soap->
tag)
15921 size_t k = strlen(tp->
name);
15929 k = strlen(tp->
value);
15962 *s++ = (wchar_t)*t++;
15978 if (
flag == 3 || (
f && n == 0))
16020 *s++ = (wchar_t)
'&';
16032 t = (
char*)
"quot;";
16039 if (
sizeof(
wchar_t) < 4 &&
c > 0xFFFF)
16042 c1 = 0xD800 - (0x10000 >> 10) + (
c >> 10);
16043 c2 = 0xDC00 + (
c & 0x3FF);
16047 *s++ = (wchar_t)(
c & 0x7FFFFFFF);
16050 if (maxlen >= 0 &&
l > (
size_t)maxlen)
16052 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"String too long: maxlen=%ld\n", maxlen));
16062 if (minlen > 0 &&
l < (
size_t)minlen)
16064 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"String too short: %lu chars, minlen=%ld\n", (
unsigned long)
l, minlen));
16070 if (
flag >= 4 && s)
16073 #ifndef WITH_LEANER
16421 if (s == r || *r || n < -128 || n > 127)
16504 if (s == r || *r || n < -32768 || n > 32767)
16558 #if defined(WITH_C_LOCALE)
16559 # if !defined(WIN32)
16560 SOAP_LOCALE_T locale;
16571 #if defined(WITH_C_LOCALE)
16575 locale = uselocale(SOAP_LOCALE(
soap));
16631 #if defined(WITH_C_LOCALE)
16632 # if defined(HAVE_STRTOD_L)
16635 *p = (float)_strtod_l(s, &r, SOAP_LOCALE(
soap));
16637 *p = (float)strtod_l(s, &r, SOAP_LOCALE(
soap));
16641 # elif defined(HAVE_STRTOF_L)
16643 *p = strtof_l((
char*)s, &r, SOAP_LOCALE(
soap));
16646 # elif defined(HAVE_SSCANF_L)
16648 if (sscanf_l(s, SOAP_LOCALE(
soap),
"%lf", &n) != 1)
16651 # elif defined(HAVE_STRTOD)
16653 SOAP_LOCALE_T locale = uselocale(SOAP_LOCALE(
soap));
16654 *p = (float)strtod((
char*)s, &r);
16658 # elif defined(HAVE_STRTOF)
16660 SOAP_LOCALE_T locale = uselocale(SOAP_LOCALE(
soap));
16661 *p = strtof((
char*)s, &r);
16665 # elif defined(HAVE_SSCANF)
16667 SOAP_LOCALE_T locale = uselocale(SOAP_LOCALE(
soap));
16668 if (sscanf(s,
"%lf", &n) != 1)
16675 #elif defined(HAVE_STRTOD)
16677 *p = (float)strtod(s, &r);
16680 #elif defined(HAVE_STRTOF)
16682 *p = strtof((
char*)s, &r);
16685 #elif defined(HAVE_SSCANF)
16687 if (sscanf(s,
"%lf", &n) != 1)
16769 #if defined(WITH_C_LOCALE)
16770 # if !defined(WIN32)
16771 SOAP_LOCALE_T locale;
16782 #if defined(WITH_C_LOCALE)
16786 locale = uselocale(SOAP_LOCALE(
soap));
16841 #if defined(WITH_C_LOCALE)
16842 # if defined(HAVE_STRTOD_L)
16845 *p = _strtod_l(s, &r, SOAP_LOCALE(
soap));
16847 *p = strtod_l(s, &r, SOAP_LOCALE(
soap));
16851 # elif defined(HAVE_STRTOD)
16853 SOAP_LOCALE_T locale = uselocale(SOAP_LOCALE(
soap));
16854 *p = strtod(s, &r);
16858 # elif defined(HAVE_SSCANF_L)
16859 SOAP_LOCALE_T locale = uselocale(SOAP_LOCALE(
soap));
16860 if (sscanf_l(s, SOAP_LOCALE(
soap),
"%lf", p) != 1)
16866 #elif defined(HAVE_STRTOD)
16868 *p = strtod(s, &r);
16871 #elif defined(HAVE_SSCANF)
16872 if (sscanf(s,
"%lf", p) != 1)
16952 if (s == r || *r || n < 0 || n > 255)
16954 *p = (
unsigned char)n;
17035 if (s == r || *r || n < 0 || n > 65535)
17037 *p = (
unsigned short)n;
17131 #ifdef HAVE_STRTOUL
17132 if (*p > 0 && strchr(s,
'-'))
17230 #ifdef HAVE_STRTOUL
17231 if (*p > 0 && strchr(s,
'-'))
17329 if (*p > 0 && strchr(s,
'-'))
17397 #ifndef WITH_COMPAT
17402 soap_s2stdchar(
struct soap *
soap,
const char *s, std::string *t,
int flag,
long minlen,
long maxlen,
const char *pattern)
17422 if (maxlen < 0 && soap->maxlength > 0)
17424 if (minlen > 0 || maxlen >= 0)
17431 if ((maxlen >= 0 &&
l > (
size_t)maxlen) || (minlen > 0 &&
l < (
size_t)minlen))
17439 #ifndef WITH_LEANER
17472 for (t = s; *t; t++)
17482 if (insitu && s < t)
17497 for (t = s; *t; t++)
17506 (void)
soap_memmove(t + 1, n - (t-s), r, n - (r-s) + 1);
17510 if (t >= s && *t == 32)
17535 #ifndef WITH_COMPAT
17540 soap_s2stdQName(
struct soap *
soap,
const char *s, std::string *t,
long minlen,
long maxlen,
const char *pattern)
17562 if (maxlen < 0 && soap->maxlength > 0)
17564 if (minlen > 0 || maxlen >= 0)
17571 if ((maxlen >= 0 &&
l > (
size_t)maxlen) || (minlen > 0 &&
l < (
size_t)minlen))
17583 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Normalized namespace(s) of QNames '%s'", s));
17589 const char *p =
NULL;
17591 const char *r =
NULL;
17607 if (!np || *s ==
'#' || !strncmp(s,
"xml:", 4))
17615 for (p = s; *p && p < s + n; p++)
17621 while (np && (strncmp(np->
id, s, k) || np->
id[k]))
17627 while (np && *np->
id)
17636 size_t k = strlen(q);
17679 k = 2*flag + m + (p ? n - (p-s) + 1 : 0) + (s[n] !=
'\0');
17699 if (
soap_memcpy((
void*)
b, k - m - flag - 1, (
const void*)p, n - (p-s)))
17732 #ifndef WITH_LEANER
17754 const char *t =
NULL;
17768 const char *q =
NULL;
17769 const char *r =
NULL;
17808 q = strchr(s + 1,
'"');
17836 x[q - s - 2] =
'\0';
17850 k = m + (q ? n - (q - s) + 1 : 0);
17865 if (
soap_memcpy((
void*)
b, k - m, (
const void*)q, n - (q - s) + 1))
17870 b += n - (q - s) + 1;
17907 #ifndef WITH_COMPAT
17913 soap_s2stdwchar(
struct soap *
soap,
const char *s, std::wstring *t,
int flag,
long minlen,
long maxlen,
const char *pattern)
17930 static const wchar_t*
17938 if (maxlen < 0 && soap->maxlength > 0)
17948 *r++ = (wchar_t)*s++;
17955 c = (
unsigned char)*s++;
17958 #ifdef WITH_REPLACE_ILLEGAL_UTF8
17960 c1 = (
unsigned char)*s;
17961 if (
c <= 0xC1 || (c1 & 0xC0) != 0x80)
17963 c = SOAP_UNKNOWN_UNICODE_CHAR;
17971 c = (((
c & 0x1F) << 6) | c1);
17975 c2 = (
unsigned char)*s;
17976 if ((
c == 0xE0 && c1 < 0x20) || (c2 & 0xC0) != 0x80)
17978 c = SOAP_UNKNOWN_UNICODE_CHAR;
17986 c = (((
c & 0x0F) << 12) | (c1 << 6) | c2);
17990 c3 = (
unsigned char)*s;
17991 if ((
c == 0xF0 && c1 < 0x10) || (
c == 0xF4 && c1 >= 0x10) ||
c >= 0xF5 || (c3 & 0xC0) != 0x80)
17993 c = SOAP_UNKNOWN_UNICODE_CHAR;
17998 c = (((
c & 0x07) << 18) | (c1 << 12) | (c2 << 6) | (c3 & 0x3F));
18006 c1 = (
unsigned char)*s;
18017 c2 = (
unsigned char)*s;
18024 c = (wchar_t)(((
soap_wchar)(
c & 0x0F) << 12) | (c1 << 6) | c2);
18028 c3 = (
unsigned char)*s;
18035 c = (wchar_t)(((
soap_wchar)(
c & 0x07) << 18) | (c1 << 12) | (c2 << 6) | c3);
18039 c4 = (
unsigned char)*s;
18046 c = (wchar_t)(((
soap_wchar)(
c & 0x03) << 24) | (c1 << 18) | (c2 << 12) | (c3 << 6) | c4);
18050 c = (wchar_t)(((
soap_wchar)(
c & 0x01) << 30) | (c1 << 24) | (c2 << 18) | (c3 << 12) | (c4 << 6) | (
unsigned char)(*s & 0x3F));
18064 if (
sizeof(
wchar_t) < 4 &&
c > 0xFFFF)
18067 c1 = 0xD800 - (0x10000 >> 10) + (
c >> 10);
18068 c2 = 0xDC00 + (
c & 0x3FF);
18082 if ((maxlen >= 0 &&
l > (
size_t)maxlen) || (minlen > 0 &&
l < (
size_t)minlen))
18089 if (flag >= 4 && t)
18092 #ifndef WITH_LEANER
18127 for (t = s; *t; t++)
18139 if (insitu && s < t)
18156 for (t = s; *t; t++)
18165 (void)
soap_memmove(t + 1,
sizeof(
wchar_t) * (n - (t-s)), r,
sizeof(wchar_t) * (n - (r-s) + 1));
18169 if (t >= s && *t == 32)
18187 const wchar_t *q = s;
18193 if (
c > 0 &&
c < 0x80)
18196 #ifdef WITH_REPLACE_ILLEGAL_UTF8
18208 if (
c > 0 &&
c < 0x80)
18215 if (
sizeof(
wchar_t) < 4 && (
c & 0xFC00) == 0xD800)
18218 if ((
d & 0xFC00) == 0xDC00)
18220 c = ((
c - 0xD800) << 10) + (
d - 0xDC00) + 0x10000;
18223 #ifdef WITH_REPLACE_ILLEGAL_UTF8
18226 c = SOAP_UNKNOWN_UNICODE_CHAR;
18232 *t++ = (char)(0xC0 | ((
c >> 6) & 0x1F));
18236 #ifdef WITH_REPLACE_ILLEGAL_UTF8
18237 if (!((
c >= 0x80 &&
c <= 0xD7FF) || (
c >= 0xE000 &&
c <= 0xFFFD) || (
c >= 0x10000 &&
c <= 0x10FFFF)))
18238 c = SOAP_UNKNOWN_UNICODE_CHAR;
18242 *t++ = (char)(0xE0 | ((
c >> 12) & 0x0F));
18248 *t++ = (char)(0xF0 | ((
c >> 18) & 0x07));
18252 if (
c < 0x04000000)
18254 *t++ = (char)(0xF8 | ((
c >> 24) & 0x03));
18258 *t++ = (char)(0xFC | ((
c >> 30) & 0x01));
18259 *t++ = (char)(0x80 | ((
c >> 24) & 0x3F));
18261 *t++ = (char)(0x80 | ((
c >> 18) & 0x3F));
18263 *t++ = (char)(0x80 | ((
c >> 12) & 0x3F));
18265 *t++ = (char)(0x80 | ((
c >> 6) & 0x3F));
18267 *t++ = (char)(0x80 | (
c & 0x3F));
18324 if (!**p && tag && *tag ==
'-')
18330 else if (tag && *tag ==
'-')
18355 #ifndef WITH_LEANER
18376 #ifndef WITH_LEANER
18404 if (!**p && tag && *tag ==
'-')
18410 else if (tag && *tag ==
'-')
18437 #define __FILETIME_to_ll(f) ((long long)(f).dwHighDateTime << 32 | (long long)(f).dwLowDateTime)
18439 mktime(
struct tm *pt)
18441 SYSTEMTIME s, s1, s2;
18442 FILETIME
f, f1, f2;
18444 GetSystemTime(&s1);
18446 SystemTimeToFileTime(&s1, &f1);
18447 SystemTimeToFileTime(&s2, &f2);
18448 diff = (__FILETIME_to_ll(f2) - __FILETIME_to_ll(f1)) / 10000000LL;
18449 s.wYear = pt->tm_year + 1900;
18450 s.wMonth = pt->tm_mon + 1;
18451 s.wDayOfWeek = pt->tm_wday;
18452 s.wDay = pt->tm_mday;
18453 s.wHour = pt->tm_hour;
18454 s.wMinute = pt->tm_min;
18455 s.wSecond = pt->tm_sec;
18456 s.wMilliseconds = 0;
18457 SystemTimeToFileTime(&s, &
f);
18458 return (time_t)((__FILETIME_to_ll(
f) - 116444736000000000LL) / 10000000LL) - (time_t)
diff;
18468 #define HAVE_GMTIME_R
18470 gmtime_r(
const time_t *t,
struct tm *pt)
18472 FILETIME
f, f1, f2;
18473 SYSTEMTIME s, s1 = {0};
18474 long long time = (
long long)(*t) * 10000000LL + 116444736000000000LL;
18475 f.dwHighDateTime = (DWORD)((time >> 32) & 0x00000000FFFFFFFF);
18476 f.dwLowDateTime = (DWORD)(time & 0x00000000FFFFFFFF);
18477 FileTimeToSystemTime(&
f, &s);
18478 pt->tm_year = s.wYear - 1900;
18479 pt->tm_mon = s.wMonth - 1;
18480 pt->tm_wday = s.wDayOfWeek;
18481 pt->tm_mday = s.wDay;
18482 s1.wYear = s.wYear;
18486 SystemTimeToFileTime(&s1, &f1);
18487 SystemTimeToFileTime(&s, &f2);
18488 pt->tm_yday = (((__FILETIME_to_ll(f2) - __FILETIME_to_ll(f1)) / 10000000LL) / (60 * 60 * 24));
18489 pt->tm_hour = s.wHour;
18490 pt->tm_min = s.wMinute;
18491 pt->tm_sec = s.wSecond;
18504 strftime(
char *buf,
size_t len,
const char *
format,
const struct tm *pT)
18506 (void)len; (void)
format;
18507 #ifndef WITH_NOZONE
18508 (
SOAP_SNPRINTF(buf, len, 20),
"%04d-%02d-%02dT%02d:%02d:%02dZ", pT->tm_year + 1900, pT->tm_mon + 1, pT->tm_mday, pT->tm_hour, pT->tm_min, pT->tm_sec);
18510 (
SOAP_SNPRINTF(buf, len, 20),
"%04d-%02d-%02dT%02d:%02d:%02d", pT->tm_year + 1900, pT->tm_mon + 1, pT->tm_mday, pT->tm_hour, pT->tm_min, pT->tm_sec);
18519 #if !defined(WITH_LEAN) || defined(WITH_COOKIES)
18525 #if defined(HAVE_TIMEGM)
18530 #ifndef HAVE_GMTIME_R
18534 if (t == (time_t)-1)
18536 #ifdef HAVE_GMTIME_R
18547 if (g == (time_t)-1)
18563 struct tm T, *pT = &T;
18565 #if defined(HAVE_GMTIME_R) && !defined(WITH_NOZONE)
18568 #elif defined(HAVE_GMTIME) && !defined(WITH_NOZONE)
18572 #elif (defined(HAVE_TM_GMTOFF) || defined(HAVE_STRUCT_TM_TM_GMTOFF) || defined(HAVE_STRUCT_TM___TM_GMTOFF)) && !defined(WITH_NOZONE)
18573 #if defined(HAVE_LOCALTIME_R)
18595 #elif defined(HAVE_GETTIMEOFDAY) && !defined(WITH_NOZONE)
18596 #if defined(HAVE_LOCALTIME_R)
18600 struct timezone tz;
18601 memset((
void*)&tz, 0,
sizeof(tz));
18602 gettimeofday(&tv, &tz);
18612 struct timezone tz;
18613 memset((
void*)&tz, 0,
sizeof(tz));
18614 gettimeofday(&tv, &tz);
18620 #elif defined(HAVE_FTIME) && !defined(WITH_NOZONE)
18621 #if defined(HAVE_LOCALTIME_R)
18625 memset((
void*)&t, 0,
sizeof(t));
18626 #ifdef __BORLANDC__
18640 memset((
void*)&t, 0,
sizeof(t));
18641 #ifdef __BORLANDC__
18651 #elif defined(HAVE_LOCALTIME_R)
18696 memset((
void*)&T, 0,
sizeof(T));
18701 T.tm_year = (int)
d;
18708 T.tm_year = (int)(
d / 10000);
18709 T.tm_mon = (int)(
d / 100 % 100);
18710 T.tm_mday = (int)(
d % 100);
18722 T.tm_hour = (int)
d;
18729 T.tm_hour = (int)(
d / 10000);
18730 T.tm_min = (int)(
d / 100 % 100);
18731 T.tm_sec = (int)(
d % 100);
18738 if (T.tm_year == 1)
18746 if (*t < '0' || *t >
'9')
18753 #ifndef WITH_NOZONE
18754 if (*t ==
'+' || *t ==
'-')
18783 T.tm_hour += T.tm_min / 60;
18790 T.tm_mday += T.tm_hour / 24;
18799 else if (*t !=
'Z')
18860 if (tag && *tag !=
'-')
18866 if (tag && *tag !=
'-')
18890 if (
soap->
body || (tag && *tag ==
'-'))
18892 if (tag && *tag !=
'-')
18898 if (!**p && tag && *tag ==
'-')
18919 #ifndef WITH_LEANER
18925 if (tag && *tag !=
'-')
18931 const wchar_t *s = *p;
18938 if (tag && *tag !=
'-')
18946 #ifndef WITH_LEANER
18966 if (tag && *tag !=
'-')
18972 if (!**p && tag && *tag ==
'-')
18978 else if (tag && *tag ==
'-')
19013 for (i = 0; i <
sizeof(
soap->
tmpbuf) - 1; i++)
19020 for (s--; i > 0; i--, s--)
19050 #if !defined(WITH_LEANER) || !defined(WITH_NOHTTP)
19064 if (
c ==
'\r' ||
c ==
'\n')
19079 if (
c !=
' ' &&
c !=
'\t')
19082 else if ((
int)
c == EOF)
19100 #ifndef WITH_LEANER
19106 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Calculating the size of DIME attachments\n"));
19109 count += 12 + ((content->
size+3)&(~3));
19111 count += ((strlen(content->
id)+3)&(~3));
19113 count += ((strlen(content->
type)+3)&(~3));
19115 count += ((((
unsigned char)content->
options[2] << 8) | ((
unsigned char)content->
options[3]))+7)&(~3);
19116 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Size of DIME attachment content is %lu bytes\n", (
unsigned long)content->
size));
19122 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Calculating the size of MIME attachments\n"));
19134 count += 29 + strlen(s);
19137 count += 14 + strlen(content->
id);
19146 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Size of MIME attachment content is %lu bytes\n", (
unsigned long)content->
size));
19160 #ifndef WITH_LEANER
19172 #ifndef WITH_LEANER
19182 n = strlen(option);
19186 s[0] = (char)(optype >> 8);
19187 s[1] = (char)(optype & 0xFF);
19188 s[2] = (char)(n >> 8);
19189 s[3] = (char)(n & 0xFF);
19199 #ifndef WITH_LEANER
19205 unsigned char tmp[12];
19206 size_t optlen = 0, idlen = 0, typelen = 0;
19213 if (idlen > 0x0000FFFF)
19214 idlen = 0x0000FFFF;
19219 if (typelen > 0x0000FFFF)
19220 typelen = 0x0000FFFF;
19224 tmp[2] = (char)(optlen >> 8);
19225 tmp[3] = (char)(optlen & 0xFF);
19226 tmp[4] = (char)(idlen >> 8);
19227 tmp[5] = (char)(idlen & 0xFF);
19228 tmp[6] = (char)(typelen >> 8);
19229 tmp[7] = (char)(typelen & 0xFF);
19245 #ifndef WITH_LEANER
19267 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"fdimereadopen failed\n"));
19273 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Chunked streaming DIME\n"));
19277 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"fdimeread returned %lu bytes\n", (
unsigned long)
size));
19281 if (!content->
next)
19303 if (!content->
next)
19317 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"fdimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (
unsigned long)
size, (
unsigned long)content->
size));
19325 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"fdimereadclose\n"));
19329 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"fdimereadclose\n"));
19335 if (!content->
next)
19348 #ifndef WITH_LEANER
19360 for (i = n; i > 0; i--)
19387 #ifndef WITH_LEANER
19396 unsigned char tmp[12];
19397 size_t optlen, idlen, typelen;
19400 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Get DIME header\n"));
19402 for (i = 12; i > 0; i--)
19412 optlen = (tmp[2] << 8) | tmp[3];
19413 idlen = (tmp[4] << 8) | tmp[5];
19414 typelen = (tmp[6] << 8) | tmp[7];
19415 soap->
dime.
size = ((size_t)tmp[8] << 24) | ((size_t)tmp[9] << 16) | ((size_t)tmp[10] << 8) | ((size_t)tmp[11]);
19435 #ifndef WITH_LEANER
19582 #ifndef WITH_LEANER
19589 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Get MIME header\n"));
19625 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"MIME header: %s\n", key));
19633 }
while (*val && *val <= 32);
19638 else if (!content->
id && !
soap_tag_cmp(key,
"Content-Disposition"))
19644 else if (!
soap_tag_cmp(key,
"Content-Transfer-Encoding"))
19656 #ifndef WITH_LEANER
19670 #ifndef WITH_LEANER
19682 #ifndef WITH_LEANER
19696 #ifndef WITH_LEANER
19704 char *s, *t =
NULL;
19708 goto post_check_exit;
19710 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Get MIME (%p)\n", (
void*)content));
19714 goto post_check_exit;
19722 goto post_check_exit;
19729 goto post_check_exit;
19743 goto post_check_exit;
19763 goto post_check_exit;
19766 if (flag ||
c ==
'\r')
19775 goto post_check_exit;
19782 }
while (
c == *t++);
19788 goto post_check_exit;
19793 flag = (
c ==
'\r');
19816 goto post_check_exit;
19831 goto post_check_exit;
19844 goto post_check_exit;
19847 goto post_check_exit;
19863 #ifndef WITH_LEANER
19874 if (!strncmp(s,
"cid:", 4))
19882 if (!strncmp(s, t, n) && !s[n])
19899 int r1, r2, r3, r4;
19900 #ifdef WITH_OPENSSL
19905 static int k = 0xFACEB00C;
19906 int lo = k % 127773;
19907 int hi = k / 127773;
19908 # if defined(HAVE_GETTIMEOFDAY)
19910 gettimeofday(&tv,
NULL);
19911 r1 = 10000000 * tv.tv_sec + tv.tv_usec;
19912 # elif defined(UNDER_CE)
19913 r1 = (int)Random();
19914 # elif !defined(WITH_LEAN)
19915 r1 = (int)time(
NULL);
19919 k = 16807 * lo - 2836 * hi;
19924 for (i = 0; i < (
sizeof(
soap->
buf) < 16UL ?
sizeof(
soap->
buf) : 16UL); i++)
19929 (
SOAP_SNPRINTF(
soap->
tmpbuf,
sizeof(
soap->
tmpbuf), prefix ? strlen(prefix) + 37 : 37),
"%s%8.8x-%4.4hx-4%3.3hx-%4.4hx-%4.4hx%8.8x", prefix ? prefix :
SOAP_STR_EOS, r1, (
short)(r2 >> 16), (
short)(((short)r2 >> 4) & 0x0FFF), (
short)(((short)(r3 >> 16) & 0x3FFF) | 0x8000), (short)r3, r4);
19935 #ifndef WITH_LEANER
19942 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Resolving attachment data for id='%s'\n", content->
id));
19948 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Found matching attachment id='%s' for content id='%s'\n", xq->
id, content->
id));
19950 *xq->
ptr = (
unsigned char*)content->
ptr;
19970 #ifndef WITH_LEANER
19983 if (s &&
soap_send3(
soap,
"Content-Transfer-Encoding: ", s,
"\r\n"))
19997 #ifndef WITH_LEANER
20006 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Sending MIME attachments\n"));
20015 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"fmimereadopen failed\n"));
20024 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Chunked streaming MIME\n"));
20028 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"fmimeread returned %lu bytes\n", (
unsigned long)
size));
20035 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Error: cannot chunk streaming MIME (no HTTP chunking)\n"));
20050 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"fmimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (
unsigned long)
size, (
unsigned long)content->
size));
20075 #ifndef WITH_LEANER
20089 #ifndef WITH_LEANER
20105 #ifndef WITH_LEANER
20119 #ifndef WITH_LEANER
20135 #ifndef WITH_LEANER
20146 s =
"application/dime";
20151 s =
"application/xop+xml; charset=utf-8; type=\"application/soap+xml\"";
20153 s =
"application/soap+xml; charset=utf-8";
20157 s =
"application/xop+xml; charset=utf-8; type=\"text/xml\"";
20161 s =
"text/xml; charset=utf-8";
20180 #ifndef WITH_LEANER
20212 #ifndef WITH_LEANER
20217 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"New DIME/MIME attachment %p (%lu)\n", (
void*)
ptr, (
unsigned long)
size));
20233 (*last)->
next = content;
20242 #ifndef WITH_LEANER
20260 #ifndef WITH_LEANER
20280 #ifndef WITH_LEANER
20287 return content->
next;
20294 #ifndef WITH_LEANER
20330 #ifndef WITH_LEANER
20341 if (content->
ptr && content->
size >= k)
20343 const char *p = (
const char*)content->
ptr;
20345 for (i = 0; i < content->
size - k; i++, p++)
20360 soap_getgziphdr(
struct soap *
soap)
20364 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Get gzip header\n"));
20365 for (i = 0; i < 9; i++)
20368 if (i == 1 &&
c == 8)
20388 }
while (
c && (
int)
c != EOF);
20390 if ((
int)
c != EOF && (
f & 0x10))
20395 }
while (
c && (
int)
c != EOF);
20397 if ((
int)
c != EOF && (
f & 0x02))
20416 #ifdef WITH_FASTCGI
20417 if (FCGI_Accept() < 0)
20431 #ifdef WITH_FASTCGI
20452 #ifndef WITH_LEANER
20458 #ifndef WITH_NOIDREF
20490 #ifndef WITH_LEANER
20506 #ifndef WITH_FASTCGI
20508 #ifdef __BORLANDC__
20535 #ifdef WITH_OPENSSL
20542 #ifndef WITH_LEANER
20550 if (soap_getgziphdr(
soap))
20563 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"gzip initialized\n"));
20580 #ifndef WITH_LEANER
20604 c = (0x0F << 12) | (0xBB << 6) | (
c & 0x3F);
20619 #ifndef WITH_NOHTTP
20645 if (soap_getgziphdr(
soap))
20650 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"gzip initialized\n"));
20670 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Inflate initialized\n"));
20681 #ifndef WITH_LEANER
20685 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Invoking fpreparerecv\n"));
20708 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Invoking http method handler\n"));
20750 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Invoking http form handler\n"));
20762 #ifndef WITH_LEANER
20793 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Chunked SOAP in DIME message\n"));
20871 for (i = 0; i < k; i++)
20923 n = strlen(prefix);
20932 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Parsing HTTP body, prefixed with '%s' (mode=0x%x)\n", prefix,
soap->
mode));
20949 for (i = 0; i < k; i++)
20954 *t++ = (char)(
c & 0xFF);
20985 for (i = 0; i < k; i++)
20997 *s++ = (char)(
c & 0xFF);
21148 if (!endpoint || !*endpoint)
21150 #ifdef WITH_OPENSSL
21155 s = strchr(endpoint,
':');
21156 if (s && s[1] ==
'/' && s[2] ==
'/')
21160 #if !defined(WITH_NOHTTP) || !defined(WITH_LEANER)
21161 t = strchr(s,
'@');
21162 if (t && *s !=
':' && *s !=
'@')
21164 size_t l = t - s + 1;
21178 r = r + strlen(r) + 1;
21195 for (i = 0; i < n; i++)
21208 for (i = 0; i < n; i++)
21211 if (s[i] ==
'/' || s[i] ==
':' || s[i] ==
'?')
21216 for (i = 0; i < n; i++)
21219 if (s[i] ==
'/' || s[i] ==
':' || s[i] ==
'?')
21227 for (i++; i < n; i++)
21245 #ifndef WITH_NOHTTP
21257 #ifndef WITH_NOHTTP
21275 #ifndef WITH_NOHTTP
21293 #ifndef WITH_NOHTTP
21311 #ifndef WITH_NOHTTP
21344 unsigned int backoff = 1;
21349 s = strchr(endpoints,
' ');
21352 size_t l = strlen(endpoints);
21353 char *endpoint =
NULL;
21360 (void)
soap_strncpy(endpoint,
l + 1, endpoints, s - endpoints);
21361 endpoint[s - endpoints] =
'\0';
21370 s = strchr(endpoints,
' ');
21372 s = endpoints + strlen(endpoints);
21383 tv.tv_sec = backoff;
21410 #ifndef WITH_LEANER
21425 if (!strncmp(endpoint,
"soap.udp:", 9) || !strncmp(endpoint,
"udp:", 4))
21457 #ifndef WITH_NOHTTP
21482 #ifndef WITH_LEANER
21493 soap_ntlm_handshake(
struct soap *
soap,
int command,
const char *endpoint,
const char *host,
int port)
21501 tSmbNtlmAuthRequest req;
21502 tSmbNtlmAuthResponse res;
21503 tSmbNtlmAuthChallenge ch;
21518 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"NTLM S->C Type 1: received NTLM authentication challenge from server\n"));
21524 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"NTLM C->S Type 2: sending NTLM authorization to server\nAuthorization: NTLM %s\n",
soap->
ntlm_challenge));
21539 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"NTLM S->C Type 2: waiting on server NTLM response\n"));
21555 buildSmbNtlmAuthResponse(&ch, &res, userid, passwd);
21557 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"NTLM C->S Type 3: sending NTLM authorization to server\nAuthorization: NTLM %s\n",
soap->
ntlm_challenge));
21599 for (; n > 2; n -= 3, s += 3)
21602 m = (m << 8) | s[1];
21603 m = (m << 8) | s[2];
21604 for (i = 4; i > 0; m >>= 6)
21612 for (i = 0; i < n; i++)
21613 m = (m << 8) | *s++;
21616 for (i = 4; i > 0; m >>= 6)
21618 for (i = 3; i > n; i--)
21646 l = (strlen(s) + 3) / 4 * 3 + 1;
21654 for (i = 0; ; i += 3,
l -= 3)
21661 if (
c ==
'=' || !
c)
21668 *t++ = (char)((m >> 4) & 0xFF);
21673 *t++ = (char)((m >> 10) & 0xFF);
21674 *t++ = (char)((m >> 2) & 0xFF);
21686 if (
c >= 0 &&
c <= 79)
21711 *t++ = (char)((m >> 16) & 0xFF);
21712 *t++ = (char)((m >> 8) & 0xFF);
21713 *t++ = (char)(m & 0xFF);
21736 *t++ = (char)((m >> 4) + (m > 159 ?
'a' - 10 :
'0'));
21738 *t++ = (char)(m + (m > 9 ?
'a' - 10 :
'0'));
21763 l = strlen(s) / 2 + 1;
21778 *t++ = (char)(((
d1 >=
'A' ? (
d1 & 0x7) + 9 :
d1 -
'0') << 4) + (d2 >=
'A' ? (d2 & 0x7) + 9 : d2 -
'0'));
21790 #ifndef WITH_NOHTTP
21798 const char *s =
"text/xml; charset=utf-8";
21799 #ifndef WITH_LEANER
21800 const char *r =
NULL;
21806 s =
"text/html; charset=utf-8";
21808 s =
"application/soap+xml; charset=utf-8";
21810 #ifndef WITH_LEANER
21816 r =
"application/soap+xml";
21819 s =
"application/xop+xml";
21823 s =
"application/dime";
21831 t = strchr(s,
';');
21874 #ifndef WITH_NOHTTP
21898 #ifndef WITH_LEANER
21978 *
c =
"SOAP-ENV:Sender";
21980 *
c =
"SOAP-ENV:Client";
21992 *s =
"Client fault";
21995 *s =
"Server fault";
22023 *
c =
"SOAP-ENV:MustUnderstand";
22028 *
c =
"SOAP-ENV:VersionMismatch";
22029 *s =
"Invalid SOAP message or SOAP version mismatch";
22032 *
c =
"SOAP-ENV:DataEncodingUnknown";
22033 *s =
"Unsupported SOAP data encoding";
22039 *s =
"User data access error";
22046 *s =
"Data required for operation";
22049 *s =
"HTTP GET method not implemented";
22052 *s =
"HTTP PUT method not implemented";
22055 *s =
"HTTP PATCH method not implemented";
22058 *s =
"HTTP DELETE method not implemented";
22061 *s =
"HTTP method error";
22064 *s =
"Out of memory";
22067 *s =
"Memory overflow or memory corruption error";
22070 *s =
"Header line too long";
22073 *s =
"Array index out of bounds";
22095 *s =
"Message too large for UDP packet";
22102 *s =
"An HTTP processing error occurred";
22105 *s =
"An HTTP NTLM authentication error occurred";
22108 #ifdef WITH_OPENSSL
22109 *s =
"SSL/TLS error";
22111 *s =
"OpenSSL not installed: recompile with -DWITH_OPENSSL";
22115 *s =
"Plugin registry error";
22121 *s =
"DIME href to missing attachment";
22124 *s =
"DIME version/transmission error";
22127 *s =
"End of DIME error";
22130 *s =
"MIME format error";
22133 *s =
"MIME href to missing attachment";
22136 *s =
"End of MIME error";
22143 *s =
"Zlib/gzip not installed for (de)compression: recompile with -DWITH_GZIP";
22153 *s =
"Maximum XML nesting depth level exceeded: increase maxlevel";
22168 *s =
"Maximum number of open connections was reached: increase FD_SETSIZE or define HAVE_POLL";
22171 *s =
"UTF content encoding error";
22174 *s =
"Stopped: service request already handled by plugin (informative)";
22185 #if defined(__cplusplus) && !defined(WITH_COMPAT)
22196 *s =
"End of file or no input";
22200 *s =
"An unspecified error occurred";
22203 #ifndef WITH_NOHTTP
22231 #ifndef WITH_NOHTTP
22232 if (status >= 200 && status <= 299)
22235 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Sending back fault struct for error code %d\n",
soap->
error));
22257 && recv(
soap->
socket, (
char*)&t, 1, MSG_PEEK) < 0))
22327 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Check (%d) if receiving SOAP Fault (status = %d)\n", check, status));
22356 if (status && (status < 200 || status > 299))
22366 && (status == 0 || (status >= 200 && status <= 299))
22371 && (status == 0 || (status >= 200 && status <= 299))
22406 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Received SOAP Fault code %s\n", s));
22419 #ifndef WITH_NOHTTP
22442 #ifndef WITH_NOHTTP
22451 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Receiving empty response\n"));
22462 #ifndef WITH_LEANER
22484 # ifdef HAVE_STRERROR_R
22485 # if !defined(_GNU_SOURCE) || (!_GNU_SOURCE && ((!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)) || defined(__ANDROID__) || !defined(__GLIBC__))
22493 return strerror(err);
22499 len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)
soap->
msgbuf, (DWORD)
sizeof(
soap->
msgbuf),
NULL);
22503 len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, 0, (LPTSTR)
soap->
msgbuf, (DWORD)(
sizeof(
soap->
msgbuf)/
sizeof(TCHAR)),
NULL);
22504 for (i = 0; i <= len; i++)
22524 int tu =
' ', ru =
' ', su =
' ';
22570 soap_set_error(
struct soap *
soap,
const char *faultcode,
const char *faultsubcodeQName,
const char *faultstring,
const char *faultdetailXML,
int soaperror)
22573 if (faultsubcodeQName)
22576 if (faultdetailXML && *faultdetailXML)
22580 *s = faultdetailXML;
22608 soap_copy_fault(
struct soap *
soap,
const char *faultcode,
const char *faultsubcodeQName,
const char *faultstring,
const char *faultdetailXML)
22611 DBGFUN2(
"soap_copy_fault",
"code=%s", faultcode ? faultcode :
"(null)",
"string=%s", faultstring ? faultstring :
"(null)")
22612 if (faultsubcodeQName)
22616 if (faultdetailXML)
22663 #ifndef WITH_NOSTDLIB
22671 fprintf(fd,
"Error: soap struct state not initialized\n");
22675 const char **
c, *v =
NULL, *s, *
d;
22695 #ifndef WITH_NOSTDLIB
22696 #ifndef WITH_COMPAT
22700 soap_stream_fault(
struct soap *
soap, std::ostream& os)
22704 os <<
"Error: soap struct state not initialized\n";
22708 const char **
c, *v =
NULL, *s, *
d;
22722 <<
"[" << (v ? v :
"no subcode") <<
"]"
22724 <<
"\"" << (s ? s :
"[no reason]") <<
"\""
22726 <<
"Detail: " << (
d ?
d :
"[no detail]")
22738 #ifndef WITH_NOSTDLIB
22746 soap_strcpy(buf, len,
"Error: soap struct not initialized");
22750 const char **
c, *v =
NULL, *s, *
d;
22780 #ifndef WITH_NOSTDLIB
22818 #ifndef WITH_NOSTDLIB
22819 #ifndef WITH_COMPAT
22823 soap_stream_fault_location(
struct soap *
soap, std::ostream& os)
22839 os <<
soap->
buf << (
char)c1 << std::endl <<
"<!-- ** HERE ** -->" << std::endl;
22874 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Registered '%s' plugin\n", p->
id));
22877 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not register plugin '%s': plugin with the same ID already registered\n", p->
id));
22881 DBGLOG(
TEST, SOAP_MESSAGE(fdebug,
"Could not register plugin '%s': plugin returned error %d or plugin ID not set or fdelete callback not set\n", p->
id ? p->
id :
"plugin ID not set", err));
22894 if (p->
id ==
id || !strcmp(p->
id,
id))
22973 void soap::destroy()
CHARSET_INFO fields description
NAME if(";${DISABLED_AC_MODULES};" MATCHES ";${MODULENAME};") continue() endif() if(EXISTS "$
fno inline small functions fno default inline endif() message("Unit tests code coverage
lib set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1) set(AC_PATH_ROOT "$
G3D::Matrix abs(const G3D::Matrix &M)
static uint pos(unsigned char c)
FMT_MODULE_EXPORT_BEGIN std::tm localtime(std::time_t time)
std::tm gmtime(std::time_t time)
FMT_BEGIN_DETAIL_NAMESPACE size_t strftime(char *str, size_t count, const char *format, const std::tm *time)
std::basic_string< Char > format(const text_style &ts, const S &format_str, const Args &... args)
int ZEXPORT deflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength)
int ZEXPORT deflateEnd(z_streamp strm)
int ZEXPORT deflate(z_streamp strm, int flush)
static Bigint * diff(Bigint *a, Bigint *b, Stack_alloc *alloc)
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
constexpr auto count() -> size_t
int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength)
int ZEXPORT inflate(z_streamp strm, int flush)
int ZEXPORT inflateEnd(z_streamp strm)
struct tm * localtime_r(const time_t *clock, struct tm *res)
ulong crc32(ulong crc, const uchar *buf, uint len)
uint16 bits() const
Returns the underlying bits in this representation. Equivalent to:
Vector2int16 & operator=(const Any &a)
const T & first(const T &value, const Tail &...)
OutputIterator copy(const RangeT &range, OutputIterator out)
auto fprintf(std::FILE *f, const S &fmt, const T &... args) -> int
SOAP_FMAC3 const char **SOAP_FMAC4 soap_faultsubcode(struct soap *soap)
SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap *soap)
SOAP_FMAC3 void SOAP_FMAC4 soap_serializefault(struct soap *soap)
SOAP_FMAC3 const char **SOAP_FMAC4 soap_faultcode(struct soap *soap)
SOAP_FMAC3 void SOAP_FMAC4 soap_serializeheader(struct soap *soap)
SOAP_FMAC3 const char *SOAP_FMAC4 soap_fault_string(struct soap *soap)
SOAP_FMAC3 const char *SOAP_FMAC4 soap_fault_subcode(struct soap *soap)
SOAP_FMAC3 const char **SOAP_FMAC4 soap_faultdetail(struct soap *soap)
SOAP_FMAC3 int SOAP_FMAC4 soap_putfault(struct soap *soap)
SOAP_FMAC3 const char **SOAP_FMAC4 soap_faultstring(struct soap *soap)
SOAP_FMAC3 const char *SOAP_FMAC4 soap_fault_detail(struct soap *soap)
SOAP_FMAC3 int SOAP_FMAC4 soap_getfault(struct soap *soap)
SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_outULONG64(struct soap *soap, const char *tag, int id, const ULONG64 *p, const char *type, int n)
SOAP_FMAC1 char *SOAP_FMAC2 soap_strdup(struct soap *soap, const char *s)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2short(struct soap *soap, const char *s, short *p)
SOAP_FMAC1 int SOAP_FMAC2 soap_recv_empty_response(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_GET(struct soap *soap, const char *endpoint, const char *action)
SOAP_FMAC1 int SOAP_FMAC2 soap_match_att(struct soap *soap, const char *tag1, const char *tag2)
static int soap_begin_attachments(struct soap *)
SOAP_FMAC1 int SOAP_FMAC2 soap_set_namespaces(struct soap *soap, const struct Namespace *p)
SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap *soap, struct soap_blist *b)
SOAP_FMAC1 int SOAP_FMAC2 soap_binary_search_string(const char **a, int n, const char *s)
SOAP_FMAC1 int SOAP_FMAC2 soap_putmimehdr(struct soap *soap, struct soap_multipart *content)
static SOAP_SOCKET tcp_accept(struct soap *, SOAP_SOCKET, struct sockaddr *, int *)
SOAP_FMAC1 void SOAP_FMAC2 soap_set_sent_logfile(struct soap *soap, const char *logfile)
SOAP_FMAC1 char *SOAP_FMAC2 soap_http_get_body_prefix(struct soap *soap, size_t *len, const char *prefix)
SOAP_FMAC1 double *SOAP_FMAC2 soap_indouble(struct soap *soap, const char *tag, double *p, const char *type, int t)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_ULONG642s(struct soap *soap, ULONG64 n)
static void soap_free_iht(struct soap *)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_unsignedInt2s(struct soap *soap, unsigned int n)
SOAP_FMAC1 int SOAP_FMAC2 soap_array_begin_out(struct soap *soap, const char *tag, int id, const char *type, const char *offset)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_float2s(struct soap *soap, float n)
static soap_wchar soap_getchunkchar(struct soap *)
static int soap_isxdigit(int)
SOAP_FMAC1 int SOAP_FMAC2 soap_begin_serve(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_connect(struct soap *soap, const char *endpoint, const char *action)
SOAP_FMAC1 void SOAP_FMAC2 soap_clr_dime(struct soap *soap)
SOAP_FMAC1 long *SOAP_FMAC2 soap_inlong(struct soap *soap, const char *tag, long *p, const char *type, int t)
SOAP_FMAC1 void *SOAP_FMAC2 soap_push_block_max(struct soap *soap, struct soap_blist *b, size_t n)
static int soap_set_error(struct soap *, const char *, const char *, const char *, const char *, int)
SOAP_FMAC1 int SOAP_FMAC2 soap_store_lab(struct soap *soap, const char *s, size_t n)
SOAP_FMAC1 struct soap_clist *SOAP_FMAC2 soap_link(struct soap *soap, int t, int n, int(*fdelete)(struct soap *, struct soap_clist *))
static size_t frecv(struct soap *, char *, size_t)
static const char * soap_strerror(struct soap *)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2double(struct soap *soap, const char *s, double *p)
SOAP_FMAC1 int SOAP_FMAC2 soap_reference(struct soap *soap, const void *p, int t)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_long2s(struct soap *soap, long n)
SOAP_FMAC1 int SOAP_FMAC2 soap_outwliteral(struct soap *soap, const char *tag, wchar_t *const *p, const char *type)
SOAP_FMAC1 char *SOAP_FMAC2 soap_http_get_body(struct soap *soap, size_t *len)
SOAP_FMAC1 int SOAP_FMAC2 soap_http_skip_body(struct soap *soap)
#define SOAP_SOCKNONBLOCK(fd)
SOAP_FMAC1 float *SOAP_FMAC2 soap_infloat(struct soap *soap, const char *tag, float *p, const char *type, int t)
SOAP_FMAC1 int SOAP_FMAC2 soap_outstring(struct soap *soap, const char *tag, int id, char *const *p, const char *type, int n)
SOAP_FMAC1 int SOAP_FMAC2 soap_flush_raw(struct soap *soap, const char *s, size_t n)
SOAP_FMAC1 void SOAP_FMAC2 soap_clr_attr(struct soap *soap)
static const char soap_enc2[40]
SOAP_FMAC1 wchar_t **SOAP_FMAC2 soap_inwliteral(struct soap *soap, const char *tag, wchar_t **p)
SOAP_FMAC1 int SOAP_FMAC2 soap_putbase64(struct soap *soap, const unsigned char *s, int n)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2unsignedLong(struct soap *soap, const char *s, unsigned long *p)
static void soap_free_ns(struct soap *)
SOAP_FMAC1 LONG64 SOAP_FMAC2 soap_code_bits(const struct soap_code_map *code_map, const char *str)
SOAP_FMAC1 int SOAP_FMAC2 soap_xop_forward(struct soap *soap, unsigned char **ptr, int *size, char **id, char **type, char **options)
SOAP_FMAC1 int SOAP_FMAC2 soap_register_plugin_arg(struct soap *soap, int(*fcreate)(struct soap *, struct soap_plugin *, void *), void *arg)
SOAP_FMAC1 int SOAP_FMAC2 soap_send_raw(struct soap *soap, const char *s, size_t n)
SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap *soap, struct soap_blist *b)
SOAP_FMAC1 int SOAP_FMAC2 soap_string_out(struct soap *soap, const char *s, int flag)
SOAP_FMAC1 unsigned short *SOAP_FMAC2 soap_inunsignedShort(struct soap *soap, const char *tag, unsigned short *p, const char *type, int t)
SOAP_FMAC1 int SOAP_FMAC2 soap_recv(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_http_has_body(struct soap *soap)
SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault_location(struct soap *soap, FILE *fd)
SOAP_FMAC1 void SOAP_FMAC2 soap_mark_dup(struct soap *soap, void *a, struct soap_plist *pp)
SOAP_FMAC1 unsigned char *SOAP_FMAC2 soap_gethex(struct soap *soap, int *n)
SOAP_FMAC1 struct soap_multipart *SOAP_FMAC2 soap_recv_mime_attachment(struct soap *soap, void *handle)
static int soap_putdimefield(struct soap *, const char *, size_t)
static void soap_free_pht(struct soap *)
SOAP_FMAC1 void SOAP_FMAC2 soap_revert(struct soap *soap)
SOAP_FMAC1 void SOAP_FMAC2 soap_set_endpoint(struct soap *soap, const char *endpoint)
SOAP_FMAC1 void SOAP_FMAC2 soap_unmark(struct soap *soap, char *mark)
SOAP_FMAC1 void SOAP_FMAC2 soap_delete(struct soap *soap, void *p)
static void soap_version(struct soap *)
SOAP_FMAC1 int SOAP_FMAC2 soap_outdateTime(struct soap *soap, const char *tag, int id, const time_t *p, const char *type, int n)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_extend_url_query(struct soap *soap, const char *s, const char *t)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_unsignedLong2s(struct soap *soap, unsigned long n)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_begin_in(struct soap *soap, const char *tag, int nillable, const char *type)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2QName(struct soap *soap, const char *s, char **t, long minlen, long maxlen, const char *pattern)
SOAP_FMAC1 int SOAP_FMAC2 soap_id_nullify(struct soap *soap, const char *id)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2dateTime(struct soap *soap, const char *s, time_t *p)
static int tcp_init(struct soap *)
static soap_wchar soap_getpi(struct soap *)
SOAP_FMAC1 short SOAP_FMAC2 soap_begin_shaky(struct soap *soap)
static int soap_has_copies(struct soap *, const char *, const char *)
SOAP_FMAC1 void *SOAP_FMAC2 soap_malloc(struct soap *soap, size_t n)
SOAP_FMAC1 int SOAP_FMAC2 soap_body_begin_in(struct soap *soap)
static int http_get(struct soap *)
SOAP_FMAC1 void SOAP_FMAC2 soap_retry(struct soap *soap)
static void * fplugin(struct soap *, const char *)
SOAP_FMAC1 struct soap_nlist *SOAP_FMAC2 soap_lookup_ns(struct soap *soap, const char *tag, size_t n)
SOAP_FMAC1 int SOAP_FMAC2 soap_append_lab(struct soap *soap, const char *s, size_t n)
SOAP_FMAC1 size_t SOAP_FMAC2 soap_hash(const char *s)
SOAP_FMAC1 int SOAP_FMAC2 soap_check_and_mark(struct soap *soap, const void *p, int t, char **mark)
SOAP_FMAC1 int SOAP_FMAC2 soap_end_count(struct soap *soap)
SOAP_FMAC1 SOAP_SOCKET SOAP_FMAC2 soap_accept(struct soap *soap)
SOAP_FMAC1 void SOAP_FMAC2 soap_set_test_logfile(struct soap *soap, const char *logfile)
SOAP_FMAC1 void SOAP_FMAC2 soap_begin(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2long(struct soap *soap, const char *s, long *p)
SOAP_FMAC1 size_t SOAP_FMAC2 soap_utf8len(const char *s)
SOAP_FMAC1 int SOAP_FMAC2 soap_flush(struct soap *soap)
SOAP_FMAC1 time_t *SOAP_FMAC2 soap_indateTime(struct soap *soap, const char *tag, time_t *p, const char *type, int t)
SOAP_FMAC1 int SOAP_FMAC2 soap_sender_fault(struct soap *soap, const char *faultstring, const char *faultdetailXML)
SOAP_FMAC1 int SOAP_FMAC2 soap_match_array(struct soap *soap, const char *type)
SOAP_FMAC1 int SOAP_FMAC2 soap_getmime(struct soap *soap)
SOAP_FMAC1 SOAP_SOCKET SOAP_FMAC2 soap_bind(struct soap *soap, const char *host, int port, int backlog)
SOAP_FMAC1 int SOAP_FMAC2 soap_end_send(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_element(struct soap *soap, const char *tag, int id, const char *type)
#define SOAP_UNKNOWN_CHAR
static int soap_valid_mime_boundary(struct soap *)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_encode_url_string(struct soap *soap, const char *s)
SOAP_FMAC1 int SOAP_FMAC2 soap_check_mime_attachments(struct soap *soap)
SOAP_FMAC1 void *SOAP_FMAC2 soap_push_block(struct soap *soap, struct soap_blist *b, size_t n)
SOAP_FMAC1 short *SOAP_FMAC2 soap_inshort(struct soap *soap, const char *tag, short *p, const char *type, int t)
SOAP_FMAC1 int SOAP_FMAC2 soap_begin_send(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_resolve(struct soap *soap)
static const char soap_indent[21]
static int http_response(struct soap *, int, ULONG64)
static const struct soap_code_map h_http_error_codes[]
SOAP_FMAC1 void SOAP_FMAC2 soap_set_recv_logfile(struct soap *soap, const char *logfile)
SOAP_FMAC1 void SOAP_FMAC2 soap_end_shaky(struct soap *soap, short f)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_result(struct soap *soap, const char *tag)
SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_getutf8(struct soap *soap)
SOAP_FMAC1 char *SOAP_FMAC2 soap_query(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_tag_cmp(const char *s, const char *t)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_tagsearch(const char *big, const char *little)
SOAP_FMAC1 int SOAP_FMAC2 soap_unlink(struct soap *soap, const void *p)
SOAP_FMAC1 int SOAP_FMAC2 soap_PUT(struct soap *soap, const char *endpoint, const char *action, const char *type)
#define SOAP_TCP_SELECT_ALL
SOAP_FMAC1 const char *SOAP_FMAC2 soap_http_content_type(struct soap *soap, int status)
SOAP_FMAC1 int SOAP_FMAC2 soap_outint(struct soap *soap, const char *tag, int id, const int *p, const char *type, int n)
#define SOAP_SOCKBLOCK(fd)
SOAP_FMAC1 void *SOAP_FMAC2 soap_memdup(struct soap *soap, const void *s, size_t n)
static int soap_isnumeric(struct soap *, const char *)
static struct soap_multipart * soap_alloc_multipart(struct soap *, struct soap_multipart **, struct soap_multipart **, const char *, size_t)
SOAP_FMAC1 int SOAP_FMAC2 soap_outunsignedLong(struct soap *soap, const char *tag, int id, const unsigned long *p, const char *type, int n)
SOAP_FMAC1 int SOAP_FMAC2 soap_outbyte(struct soap *soap, const char *tag, int id, const char *p, const char *type, int n)
SOAP_FMAC1 size_t SOAP_FMAC2 soap_getsizes(const char *attr, int *size, int dim)
SOAP_FMAC1 ULONG64 SOAP_FMAC2 soap_tell(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_outliteral(struct soap *soap, const char *tag, char *const *p, const char *type)
SOAP_FMAC1 void SOAP_FMAC2 soap_strcat(char *t, size_t n, const char *s)
static const char * soap_string(struct soap *soap, const char *s, int flag, long minlen, long maxlen, const char *pattern)
SOAP_FMAC1 int SOAP_FMAC2 soap_embed(struct soap *soap, const void *p, const void *a, int n, int t)
SOAP_FMAC1 int SOAP_FMAC2 soap_outLONG64(struct soap *soap, const char *tag, int id, const LONG64 *p, const char *type, int n)
SOAP_FMAC1 int SOAP_FMAC2 soap_send_empty_response(struct soap *soap, int httpstatuscode)
SOAP_FMAC1 int SOAP_FMAC2 soap_attribute(struct soap *soap, const char *name, const char *value)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2unsignedByte(struct soap *soap, const char *s, unsigned char *p)
SOAP_FMAC1 struct soap_ilist *SOAP_FMAC2 soap_lookup(struct soap *soap, const char *id)
static const struct soap_code_map h_error_codes[]
SOAP_FMAC1 void *SOAP_FMAC2 soap_mark_lookup(struct soap *soap, const void *p, int t, struct soap_plist **ppp, char **mark)
const char soap_base64i[81]
SOAP_FMAC1 void SOAP_FMAC2 soap_pop_namespace(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_envelope_end_out(struct soap *soap)
SOAP_FMAC1 void *SOAP_FMAC2 soap_id_lookup(struct soap *soap, const char *id, void **p, int t, size_t n, unsigned int k, int(*fbase)(int, int))
static const wchar_t * soap_wstring(struct soap *soap, const char *s, int flag, long minlen, long maxlen, const char *pattern)
SOAP_FMAC1 void SOAP_FMAC2 soap_done(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_outunsignedByte(struct soap *soap, const char *tag, int id, const unsigned char *p, const char *type, int n)
SOAP_FMAC1 int SOAP_FMAC2 soap_outunsignedInt(struct soap *soap, const char *tag, int id, const unsigned int *p, const char *type, int n)
SOAP_FMAC1 const struct soap_code_map *SOAP_FMAC2 soap_code(const struct soap_code_map *code_map, const char *str)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_int2s(struct soap *soap, int n)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_code_list(struct soap *soap, const struct soap_code_map *code_map, long code)
SOAP_FMAC1 int SOAP_FMAC2 soap_end_send_flush(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2unsignedShort(struct soap *soap, const char *s, unsigned short *p)
SOAP_FMAC1 int SOAP_FMAC2 soap_match_tag(struct soap *soap, const char *tag1, const char *tag2)
SOAP_FMAC1 int SOAP_FMAC2 soap_getdimehdr(struct soap *soap)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_current_namespace_att(struct soap *soap, const char *tag)
SOAP_FMAC1 int SOAP_FMAC2 soap_poll(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_attachment(struct soap *soap, const char *tag, int id, const void *p, const void *a, int n, const char *aid, const char *atype, const char *aoptions, const char *type, int t)
SOAP_FMAC1 ULONG64 *SOAP_FMAC2 soap_inULONG64(struct soap *soap, const char *tag, ULONG64 *p, const char *type, int t)
#define SOAP_TCP_SELECT_PIP
SOAP_FMAC1 int SOAP_FMAC2 soap_s2LONG64(struct soap *soap, const char *s, LONG64 *p)
static void soap_init_pht(struct soap *)
SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy(const struct soap *soap)
static const char soap_env1[42]
SOAP_FMAC1 const char *SOAP_FMAC2 soap_double2s(struct soap *soap, double n)
SOAP_FMAC1 LONG64 SOAP_FMAC2 soap_code_int(const struct soap_code_map *code_map, const char *str, LONG64 other)
static int soap_getattrval(struct soap *, char *, size_t *, soap_wchar)
SOAP_FMAC1 char *SOAP_FMAC2 soap_s2base64(struct soap *soap, const unsigned char *s, char *t, int n)
SOAP_FMAC1 int SOAP_FMAC2 soap_sender_fault_subcode(struct soap *soap, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2byte(struct soap *soap, const char *s, char *p)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_code_str(const struct soap_code_map *code_map, long code)
static int tcp_disconnect(struct soap *)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_dateTime2s(struct soap *soap, time_t n)
SOAP_FMAC1 time_t SOAP_FMAC2 soap_timegm(struct tm *T)
SOAP_FMAC1 wchar_t *SOAP_FMAC2 soap_wstrtrim(struct soap *soap, wchar_t *s)
static void soap_resolve_attachment(struct soap *, struct soap_multipart *)
static const char soap_padding[4]
SOAP_FMAC1 int *SOAP_FMAC2 soap_inint(struct soap *soap, const char *tag, int *p, const char *type, int t)
SOAP_FMAC1 void SOAP_FMAC2 soap_clr_mime(struct soap *soap)
static const struct soap_code_map mime_codes[]
SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault(struct soap *soap, FILE *fd)
SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_get(struct soap *soap)
SOAP_FMAC1 void *SOAP_FMAC2 soap_id_enter(struct soap *soap, const char *id, void *p, int t, size_t n, const char *type, const char *arrayType, void *(*finstantiate)(struct soap *, int, const char *, const char *, size_t *), int(*fbase)(int, int))
static int soap_type_punned(struct soap *, const struct soap_ilist *)
SOAP_FMAC1 char *SOAP_FMAC2 soap_string_in(struct soap *soap, int flag, long minlen, long maxlen, const char *pattern)
SOAP_FMAC1 int SOAP_FMAC2 soap_encode_url(const char *s, char *t, int len)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_value(struct soap *soap)
static soap_wchar soap_char(struct soap *)
SOAP_FMAC1 LONG64 *SOAP_FMAC2 soap_inLONG64(struct soap *soap, const char *tag, LONG64 *p, const char *type, int t)
SOAP_FMAC1 char *SOAP_FMAC2 soap_dime_option(struct soap *soap, unsigned short optype, const char *option)
SOAP_FMAC1 int SOAP_FMAC2 soap_getposition(const char *attr, int *pos)
SOAP_FMAC1 char *SOAP_FMAC2 soap_http_get_form(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_POST(struct soap *soap, const char *endpoint, const char *action, const char *type)
SOAP_FMAC1 int SOAP_FMAC2 soap_recv_fault(struct soap *soap, int check)
SOAP_FMAC1 struct soap_multipart *SOAP_FMAC2 soap_next_multipart(struct soap_multipart *content)
SOAP_FMAC1 int SOAP_FMAC2 soap_outunsignedShort(struct soap *soap, const char *tag, int id, const unsigned short *p, const char *type, int n)
static int tcp_select(struct soap *, SOAP_SOCKET, int, int)
#define SOAP_TCP_SELECT_ERR
SOAP_FMAC1 void SOAP_FMAC2 soap_url_query(struct soap *soap, const char *s, const char *t)
SOAP_FMAC1 void SOAP_FMAC2 soap_del(struct soap *soap)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_unsignedShort2s(struct soap *soap, unsigned short n)
SOAP_FMAC1 int SOAP_FMAC2 soap_outwstring(struct soap *soap, const char *tag, int id, wchar_t *const *p, const char *type, int n)
SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_lookup(struct soap *soap, const void *p, int type, struct soap_plist **ppp)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_nil(struct soap *soap, const char *tag)
SOAP_FMAC1 int SOAP_FMAC2 soap_getoffsets(const char *attr, const int *size, int *offset, int dim)
SOAP_FMAC1 int SOAP_FMAC2 soap_PATCH(struct soap *soap, const char *endpoint, const char *action, const char *type)
SOAP_FMAC1 void SOAP_FMAC2 soap_initialize(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_begin_count(struct soap *soap)
static int http_patch(struct soap *)
static int http_post(struct soap *, const char *, const char *, int, const char *, const char *, ULONG64)
SOAP_FMAC1 size_t SOAP_FMAC2 soap_size(const int *size, int dim)
SOAP_FMAC1 void SOAP_FMAC2 soap_copy_stream(struct soap *copy, struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_outshort(struct soap *soap, const char *tag, int id, const short *p, const char *type, int n)
SOAP_FMAC1 void SOAP_FMAC2 soap_update_pointers(struct soap *soap, const char *dst, const char *src, size_t len)
static int tcp_gethostbyname(struct soap *, const char *addr, struct hostent *hostent, struct in_addr *inaddr)
SOAP_FMAC1 void SOAP_FMAC2 soap_free(struct soap *soap)
static const char * tcp_error(struct soap *)
SOAP_FMAC1 int SOAP_FMAC2 soap_begin_recv(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_match_namespace(struct soap *soap, const char *id1, const char *id2, size_t n1, size_t n2)
SOAP_FMAC1 struct soap_ilist *SOAP_FMAC2 soap_enter(struct soap *soap, const char *id, int t, size_t n)
SOAP_FMAC1 int SOAP_FMAC2 soap_pututf8(struct soap *soap, unsigned long c)
SOAP_FMAC1 char *SOAP_FMAC2 soap_query_key(struct soap *soap, char **s)
static void soap_select_mime_boundary(struct soap *)
SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap *soap, struct soap_blist *b)
static ULONG64 soap_count_attachments(struct soap *)
SOAP_FMAC1 void SOAP_FMAC2 soap_free_temp(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_send2(struct soap *soap, const char *s1, const char *s2)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_extend_url(struct soap *soap, const char *s, const char *t)
SOAP_FMAC1 int SOAP_FMAC2 soap_send3(struct soap *soap, const char *s1, const char *s2, const char *s3)
SOAP_FMAC1 int SOAP_FMAC2 soap_getdime(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_start_end_out(struct soap *soap, const char *tag)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_decode_val(char *buf, size_t len, const char *val)
SOAP_FMAC1 char **SOAP_FMAC2 soap_inliteral(struct soap *soap, const char *tag, char **p)
SOAP_FMAC1 char **SOAP_FMAC2 soap_instring(struct soap *soap, const char *tag, char **p, const char *type, int t, int flag, long minlen, long maxlen, const char *pattern)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2unsignedInt(struct soap *soap, const char *s, unsigned int *p)
SOAP_FMAC1 char *SOAP_FMAC2 soap_strtrim(struct soap *soap, char *s)
SOAP_FMAC1 int SOAP_FMAC2 soap_body_end_out(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_envelope_begin_in(struct soap *soap)
const char soap_base64o[65]
SOAP_FMAC1 int SOAP_FMAC2 soap_set_dime_attachment(struct soap *soap, const char *ptr, size_t size, const char *type, const char *id, unsigned short optype, const char *option)
static int fsend(struct soap *, const char *, size_t)
static const char * soap_set_validation_fault(struct soap *, const char *, const char *)
SOAP_FMAC1 int SOAP_FMAC2 soap_is_single(struct soap *soap, struct soap_plist *pp)
SOAP_FMAC1 int SOAP_FMAC2 soap_array_reference(struct soap *soap, const void *p, const void *a, int n, int t)
static int tcp_closesocket(struct soap *, SOAP_SOCKET)
static struct soap_nlist * soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized, short isearly)
static int http_put(struct soap *)
SOAP_FMAC1 char *SOAP_FMAC2 soap_s2hex(struct soap *soap, const unsigned char *s, char *t, int n)
static const char * http_error(struct soap *, int)
SOAP_FMAC1 struct soap_nlist *SOAP_FMAC2 soap_push_namespace(struct soap *soap, const char *id, const char *ns)
static int soap_init_send(struct soap *)
SOAP_FMAC1 int SOAP_FMAC2 soap_set_sender_error(struct soap *soap, const char *faultstring, const char *faultdetailXML, int soaperror)
SOAP_FMAC1 char *SOAP_FMAC2 soap_inbyte(struct soap *soap, const char *tag, char *p, const char *type, int t)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_id(struct soap *soap, const char *tag, int id, const void *p, const void *a, int n, const char *type, int t, char **mark)
static int http_post_header(struct soap *, const char *, const char *)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2int(struct soap *soap, const char *s, int *p)
SOAP_FMAC1 void *SOAP_FMAC2 soap_lookup_plugin(struct soap *soap, const char *id)
SOAP_FMAC1 char *SOAP_FMAC2 soap_save_block(struct soap *soap, struct soap_blist *b, char *p, int flag)
SOAP_FMAC1 wchar_t **SOAP_FMAC2 soap_inwstring(struct soap *soap, const char *tag, wchar_t **p, const char *type, int t, int flag, long minlen, long maxlen, const char *pattern)
static const char soap_env2[40]
SOAP_FMAC1 int SOAP_FMAC2 soap_strncat(char *t, size_t n, const char *s, size_t m)
static const struct soap_code_map html_entity_codes[]
SOAP_FMAC1 int SOAP_FMAC2 soap_s2float(struct soap *soap, const char *s, float *p)
SOAP_FMAC1 int SOAP_FMAC2 soap_attachment_forward(struct soap *soap, unsigned char **ptr, int *size, char **id, char **type, char **options)
SOAP_FMAC1 int SOAP_FMAC2 soap_query_send_key(struct soap *soap, const char *s)
SOAP_FMAC1 void SOAP_FMAC2 soap_free_stream(struct soap *soap)
static char * soap_getdimefield(struct soap *, size_t)
SOAP_FMAC1 int SOAP_FMAC2 soap_puthex(struct soap *soap, const unsigned char *s, int n)
SOAP_FMAC1 void *SOAP_FMAC2 soap_id_forward(struct soap *soap, const char *href, void *p, size_t i, int t, int tt, size_t n, unsigned int k, void(*finsert)(struct soap *, int, int, void *, size_t, const void *, void **), int(*fbase)(int, int))
static int http_parse(struct soap *)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_rand_uuid(struct soap *soap, const char *prefix)
static void soap_init_iht(struct soap *)
static const char * soap_QName(struct soap *soap, const char *s, long minlen, long maxlen, const char *pattern)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_http_header_attribute(struct soap *soap, const char *line, const char *key)
SOAP_FMAC1 int SOAP_FMAC2 soap_envelope_end_in(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_move(struct soap *soap, ULONG64 n)
SOAP_FMAC1 char *SOAP_FMAC2 soap_next_block(struct soap *soap, struct soap_blist *b)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2char(struct soap *soap, const char *s, char **t, int flag, long minlen, long maxlen, const char *pattern)
SOAP_FMAC1 int SOAP_FMAC2 soap_array_pointer_lookup(struct soap *soap, const void *p, const void *a, int n, int type, struct soap_plist **ppp)
SOAP_FMAC1 void SOAP_FMAC2 soap_post_check_mime_attachments(struct soap *soap)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_byte2s(struct soap *soap, char n)
SOAP_FMAC1 unsigned long *SOAP_FMAC2 soap_inunsignedLong(struct soap *soap, const char *tag, unsigned long *p, const char *type, int t)
SOAP_FMAC1 int SOAP_FMAC2 soap_response(struct soap *soap, int status)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_wchar2s(struct soap *soap, const wchar_t *s)
static const char soap_rpc[35]
SOAP_FMAC1 int SOAP_FMAC2 soap_putmime(struct soap *soap)
SOAP_FMAC1 unsigned char *SOAP_FMAC2 soap_inunsignedByte(struct soap *soap, const char *tag, unsigned char *p, const char *type, int t)
static int tcp_shutdownsocket(struct soap *, SOAP_SOCKET, int)
SOAP_FMAC1 int SOAP_FMAC2 soap_getline(struct soap *soap, char *buf, int len)
SOAP_FMAC1 wchar_t *SOAP_FMAC2 soap_wstrdup(struct soap *soap, const wchar_t *s)
SOAP_FMAC1 int SOAP_FMAC2 soap_outdouble(struct soap *soap, const char *tag, int id, const double *p, const char *type, int n)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_decode_key(char *buf, size_t len, const char *val)
SOAP_FMAC1 int SOAP_FMAC2 soap_envelope_begin_out(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_send(struct soap *soap, const char *s)
SOAP_FMAC1 void SOAP_FMAC2 soap_delegate_deletion(struct soap *soap, struct soap *soap_to)
SOAP_FMAC1 int SOAP_FMAC2 soap_recv_raw(struct soap *soap)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_hex2s(struct soap *soap, const char *s, char *t, size_t l, int *n)
SOAP_FMAC1 int SOAP_FMAC2 soap_send_fault(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_receiver_fault(struct soap *soap, const char *faultstring, const char *faultdetailXML)
static int http_del(struct soap *)
SOAP_FMAC1 int SOAP_FMAC2 soap_end_recv(struct soap *soap)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_unsignedByte2s(struct soap *soap, unsigned char n)
SOAP_FMAC1 int SOAP_FMAC2 soap_set_mime_attachment(struct soap *soap, const char *ptr, size_t size, enum soap_mime_encoding encoding, const char *type, const char *id, const char *location, const char *description)
SOAP_FMAC1 int SOAP_FMAC2 soap_connect_command(struct soap *soap, int http_command, const char *endpoints, const char *action)
SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_enter(struct soap *soap, const void *p, const void *a, int n, int type, struct soap_plist **ppp)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_query_decode(char *buf, size_t len, const char *val)
static int http_parse_header(struct soap *, const char *, const char *)
SOAP_FMAC1 wchar_t *SOAP_FMAC2 soap_wstring_in(struct soap *soap, int flag, long minlen, long maxlen, const char *pattern)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_href(struct soap *soap, const char *tag, int id, const char *ref, const char *val)
SOAP_FMAC1 int SOAP_FMAC2 soap_is_embedded(struct soap *soap, struct soap_plist *pp)
static int http_200(struct soap *)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_begin_out(struct soap *soap, const char *tag, int id, const char *type)
SOAP_FMAC1 int SOAP_FMAC2 soap_lookup_type(struct soap *soap, const char *id)
SOAP_FMAC1 char *SOAP_FMAC2 soap_query_val(struct soap *soap, char **s)
SOAP_FMAC1 char *SOAP_FMAC2 soap_putsizesoffsets(struct soap *soap, const char *type, const int *size, const int *offset, int dim)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_end(struct soap *soap, const char *tag)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_ref(struct soap *soap, const char *tag, int id, int href)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_attr_value(struct soap *soap, const char *name, int flag, int occurs)
static const char * soap_decode(char *, size_t, const char *, const char *)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_LONG642s(struct soap *soap, LONG64 n)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_short2s(struct soap *soap, short n)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n)
SOAP_FMAC1 int SOAP_FMAC2 soap_getmimehdr(struct soap *soap)
static wchar_t * soap_wcollapse(struct soap *soap, wchar_t *s, int flag, int insitu)
SOAP_FMAC1 int SOAP_FMAC2 soap_match_cid(struct soap *soap, const char *s, const char *t)
#define SOAP_TCP_SELECT_SND
SOAP_FMAC1 void SOAP_FMAC2 soap_versioning() soap_init(struct soap *soap, soap_mode imode, soap_mode omode)
SOAP_FMAC1 int SOAP_FMAC2 soap_receiver_fault_subcode(struct soap *soap, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML)
SOAP_FMAC1 int SOAP_FMAC2 soap_puthttphdr(struct soap *soap, int status, ULONG64 count)
SOAP_FMAC1 int SOAP_FMAC2 soap_recv_header(struct soap *soap)
SOAP_FMAC1 void SOAP_FMAC2 soap_set_version(struct soap *soap, short version)
SOAP_FMAC1 int SOAP_FMAC2 soap_set_attr(struct soap *soap, const char *name, const char *value, int flag)
SOAP_FMAC1 int SOAP_FMAC2 soap_mark_cycle(struct soap *soap, struct soap_plist *pp)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_null(struct soap *soap, const char *tag, int id, const char *type)
SOAP_FMAC1 char *SOAP_FMAC2 soap_putoffsets(struct soap *soap, const int *offset, int dim)
static int soap_is_shaky(struct soap *, void *)
SOAP_FMAC1 void SOAP_FMAC2 soap_cleanup(struct soap *soap)
static int soap_end_attachments(struct soap *soap)
SOAP_FMAC1 void SOAP_FMAC2 soap_set_local_namespaces(struct soap *soap)
SOAP_FMAC1 unsigned int *SOAP_FMAC2 soap_inunsignedInt(struct soap *soap, const char *tag, unsigned int *p, const char *type, int t)
SOAP_FMAC1 int SOAP_FMAC2 soap_DELETE(struct soap *soap, const char *endpoint)
SOAP_FMAC1 int SOAP_FMAC2 soap_query_send_val(struct soap *soap, const char *s)
SOAP_FMAC1 void SOAP_FMAC2 soap_set_fault(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_force_closesock(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2ULONG64(struct soap *soap, const char *s, ULONG64 *p)
SOAP_FMAC1 void SOAP_FMAC2 soap_end(struct soap *soap)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_QName2s(struct soap *soap, const char *s)
SOAP_FMAC1 int SOAP_FMAC2 soap_outfloat(struct soap *soap, const char *tag, int id, const float *p, const char *type, int n)
SOAP_FMAC1 int SOAP_FMAC2 soap_body_end_in(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_ignore(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_ready(struct soap *soap)
static int soap_copy_fault(struct soap *, const char *, const char *, const char *, const char *)
SOAP_FMAC1 struct soap_blist *SOAP_FMAC2 soap_alloc_block(struct soap *soap)
SOAP_FMAC1 char *SOAP_FMAC2 soap_first_block(struct soap *soap, struct soap_blist *b)
SOAP_FMAC1 int SOAP_FMAC2 soap_embedded_id(struct soap *soap, int id, const void *p, int t)
SOAP_FMAC1 int SOAP_FMAC2 soap_outlong(struct soap *soap, const char *tag, int id, const long *p, const char *type, int n)
SOAP_FMAC1 void SOAP_FMAC2 soap_check_result(struct soap *soap, const char *tag)
SOAP_FMAC1 char *SOAP_FMAC2 soap_sprint_fault(struct soap *soap, char *buf, size_t len)
#define SOAP_TCP_SELECT_RCV
SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap *soap, struct soap_blist *b, size_t n)
SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_getchar(struct soap *soap)
SOAP_FMAC1 void SOAP_FMAC2 soap_dealloc(struct soap *soap, void *p)
static SOAP_SOCKET tcp_connect(struct soap *, const char *endpoint, const char *host, int port)
SOAP_FMAC1 void SOAP_FMAC2 soap_embedded(struct soap *soap, const void *p, int t)
SOAP_FMAC1 const char *SOAP_FMAC2 soap_current_namespace_tag(struct soap *soap, const char *tag)
SOAP_FMAC1 int SOAP_FMAC2 soap_putdime(struct soap *soap)
SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(struct soap *copy, const struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_closesock(struct soap *soap)
static void soap_utilize_ns(struct soap *soap, const char *tag, short isearly)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_empty(struct soap *soap, const char *tag)
SOAP_FMAC1 int SOAP_FMAC2 soap_wstring_out(struct soap *soap, const wchar_t *s, int flag)
SOAP_FMAC1 int SOAP_FMAC2 soap_attachment_reference(struct soap *soap, const void *p, const void *a, int n, int t, const char *id, const char *type)
static char * soap_collapse(struct soap *soap, char *s, int flag, int insitu)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_end_in(struct soap *soap, const char *tag)
SOAP_FMAC1 int SOAP_FMAC2 soap_set_receiver_error(struct soap *soap, const char *faultstring, const char *faultdetailXML, int soaperror)
SOAP_FMAC1 int SOAP_FMAC2 soap_putdimehdr(struct soap *soap)
SOAP_FMAC1 void SOAP_FMAC2 soap_set_dime(struct soap *soap)
SOAP_FMAC1 int SOAP_FMAC2 soap_peek_element(struct soap *soap)
static const char soap_enc1[42]
static int soap_try_connect_command(struct soap *, int http_command, const char *endpoint, const char *action)
static int http_send_header(struct soap *, const char *)
SOAP_FMAC1 int SOAP_FMAC2 soap_body_begin_out(struct soap *soap)
static int tcp_gethost(struct soap *, const char *addr, struct in_addr *inaddr)
SOAP_FMAC1 void SOAP_FMAC2 soap_set_embedded(struct soap *soap, struct soap_plist *pp)
SOAP_FMAC1 int SOAP_FMAC2 soap_element_end_out(struct soap *soap, const char *tag)
SOAP_FMAC1 int SOAP_FMAC2 soap_s2wchar(struct soap *soap, const char *s, wchar_t **t, int flag, long minlen, long maxlen, const char *pattern)
SOAP_FMAC1 void **SOAP_FMAC2 soap_id_smart(struct soap *soap, const char *id, int t, size_t n)
SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_versioning() soap_new(soap_mode imode, soap_mode omode)
SOAP_FMAC1 void SOAP_FMAC2 soap_set_mime(struct soap *soap, const char *boundary, const char *start)
SOAP_FMAC1 unsigned char *SOAP_FMAC2 soap_getbase64(struct soap *soap, int *n, int malloc_flag)
#define SOAP_BINARY_BUFLEN
#define soap_strncpy(buf, len, src, num)
#define SOAP_IO_KEEPALIVE
SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_accept(struct soap *)
SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_crl(struct soap *, const char *)
#define SOAP_DATAENCODINGUNKNOWN
#define SOAP_SSL_NO_DEFAULT_CA_PATH
#define DBGFUN2(FNAME, FMT1, ARG1, FMT2, ARG2)
#define soap_memmove(buf, len, src, num)
#define soap_unget(soap, c)
#define SOAP_DUPLICATE_ID
#define SOAP_ZLIB_DEFLATE
#define DBGMSG(DBGFILE, MSG, LEN)
#define soap_init1(soap, mode)
SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_client_context(struct soap *soap, unsigned short flags, const char *keyfile, const char *password, const char *cafile, const char *capath, const char *randfile)
#define SOAP_MAXARRAYSIZE
#define SOAP_DIME_MISMATCH
#define SOAP_SSL_SKIP_HOST_CHECK
SOAP_FMAC1 void SOAP_FMAC2 soap_ssl_noinit(void)
#define SOAP_ECONNREFUSED
#define soap_versioning(name)
@ SOAP_MIME_QUOTED_PRINTABLE
#define SOAP_MAXINFLATESIZE
SOAP_FMAC1 void SOAP_FMAC2 soap_ssl_init(void)
#define soap_valid_socket(sk)
SOAP_FMAC1 void SOAP_FMAC2 soap_track_free(struct soap *, const char *, int, void *)
#define SOAP_VERSIONMISMATCH
#define SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION
#define DBGLOG(DBGFILE, CMD)
#define SOAP_SYNTAX_ERROR
#define soap_memcpy(buf, len, src, num)
#define soap_strcpy(buf, len, src)
#define soap_revget1(soap)
#define soap_strtol(s, t, b)
#define SOAP_MINDEFLATERATIO
SOAP_NMAC struct Namespace namespaces[]
SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_server_context(struct soap *soap, unsigned short flags, const char *keyfile, const char *password, const char *cafile, const char *capath, const char *dhfile, const char *randfile, const char *sid)
#define SOAP_SNPRINTF(buf, len, num)
#define SOAP_DELETE_UNMANAGED(soap)
SOAP_FMAC1 void SOAP_FMAC2 soap_open_logfile(struct soap *, int)
#define SOAP_MUSTUNDERSTAND
#define SOAP_NEW_UNMANAGED(soap)
#define SOAP_XSTRINGIFY(s)
#define SOAP_XML_CANONICAL
#define SOAP_END_ENVELOPE
#define DBGHEX(DBGFILE, MSG, LEN)
#define soap_destroy(soap)
#define SOAP_TAG_MISMATCH
#define soap_closesocket(n)
#define SOAP_ULONG_FORMAT
#define SOAP_XML_IGNORENS
#define SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION
#define SOAP_PLUGIN_ERROR
#define SOAP_MAXKEEPALIVE
#define SOAP_MALLOC_UNMANAGED(size)
#define SOAP_XML_CANONICAL_NA
SOAP_FMAC1 const char *SOAP_FMAC2 soap_ssl_error(struct soap *, int ret, int err)
#define SOAP_ZLIB_INFLATE
#define SOAP_DIME_VERSION
SOAP_FMAC1 void SOAP_FMAC2 soap_close_logfiles(struct soap *)
#define SOAP_SSL_ALLOW_EXPIRED_CERTIFICATE
SOAP_FMAC1 void *SOAP_FMAC2 soap_track_malloc(struct soap *, const char *, int, size_t)
#define SOAP_XML_DEFAULTNS
#define SOAP_FREE_UNMANAGED(ptr)
#define soap_init2(soap, imode, omode)
#define SOAP_INVALID_SOCKET
#define SOAP_SOURCE_STAMP(str)
#define soap_socket_errno
#define soap_check_state(soap)
#define soap_strrchr(s, t)
#define SOAP_GAI_STRERROR
#define SOAP_MIME_POSTCHECK
#define SOAP_NO_LINK_TO_DELETE
#define SOAP_SNPRINTF_SAFE(buf, len)
#define SOAP_MALLOC(soap, size)
#define SOAP_FREE(soap, ptr)
#define soap_strtoul(s, t, b)
#define SOAP_PATCH_METHOD
#define SOAP_MAXALLOCSIZE
struct soap_attribute * next
int(* fdelete)(struct soap *, struct soap_clist *)
struct soap_cookie * next
struct soap_multipart * list
struct soap_multipart * first
struct soap_multipart * last
struct soap_dom_attribute * next
struct soap_dom_element * next
struct soap_dom_element * elts
struct soap_dom_element * prnt
struct soap_dom_attribute * atts
void(* finsert)(struct soap *, int, int, void *, size_t, const void *, void **)
struct soap_flist * flist
struct soap_multipart * first
struct soap_multipart * last
struct soap_multipart * list
struct soap_multipart * next
enum soap_mime_encoding encoding
struct soap_plist plist[SOAP_PTRBLK]
void(* fdelete)(struct soap *soap, struct soap_plugin *p)
struct soap_plugin * next
int(* fcopy)(struct soap *soap, struct soap_plugin *dst, struct soap_plugin *src)
int(* fprepareinitrecv)(struct soap *)
int(* fresponse)(struct soap *, int, ULONG64)
const char * logfile[SOAP_MAXLOGS]
unsigned short linger_time
void *(* fdimewriteopen)(struct soap *, const char *, const char *, const char *)
const char * proxy_http_version
struct soap_plist * pht[SOAP_PTRHASH]
const char * override_host
int(* ffiltersend)(struct soap *, const char **, size_t *)
int(* fpreparefinalsend)(struct soap *)
int(* fclose)(struct soap *)
int(* fsend)(struct soap *, const char *, size_t)
FILE * fdebug[SOAP_MAXLOGS]
int(* fform)(struct soap *)
int(* fpreparerecv)(struct soap *, const char *, size_t)
struct soap_ilist * iht[SOAP_IDHASH]
int(* fdel)(struct soap *)
int(* fprepareinitsend)(struct soap *)
unsigned int ipv6_multicast_if
int(* fput)(struct soap *)
int(* fpatch)(struct soap *)
const char * http_version
int(* fconnect)(struct soap *, const char *, const char *, int)
size_t(* fdimeread)(struct soap *, void *, char *, size_t)
struct soap_attribute * attributes
int(* feltbegout)(struct soap *, const char *, int, const char *)
int(* fposthdr)(struct soap *, const char *, const char *)
int(* feltendout)(struct soap *, const char *)
int(* fshutdownsocket)(struct soap *, SOAP_SOCKET, int)
int(* fpreparesend)(struct soap *, const char *, size_t)
const char * encodingStyle
int(* fheader)(struct soap *)
const char * x_frame_options
void *(* fmimewriteopen)(struct soap *, void *, const char *, const char *, const char *, enum soap_mime_encoding)
int(* fwvalidate)(struct soap *, const char *, const wchar_t *)
const char * float_format
const char * proxy_userid
int(* fpoll)(struct soap *)
unsigned int tcp_keep_cnt
unsigned int tcp_keep_intvl
int(* feltendin)(struct soap *, const char *, const char *)
const char * dime_id_format
void(* fdimewriteclose)(struct soap *, void *)
int(* fget)(struct soap *)
const char * client_addr_ipv6
void(* fdimereadclose)(struct soap *, void *)
unsigned int tcp_keep_idle
struct SOAP_ENV__Fault * fault
int(* fdimewrite)(struct soap *, void *, const char *, size_t)
struct soap_blist * blist
int(* fhead)(struct soap *)
struct soap_mlist * mht[SOAP_PTRHASH]
int(* fclosesocket)(struct soap *, SOAP_SOCKET)
unsigned char ipv4_multicast_ttl
const char * client_interface
int(* fopt)(struct soap *)
int(* fserveloop)(struct soap *)
int(* fparse)(struct soap *)
char session_host[SOAP_TAGLEN]
SOAP_SOCKET(* fopen)(struct soap *, const char *, const char *, int)
void *(* fdimereadopen)(struct soap *, void *, const char *, const char *, const char *)
struct sockaddr_storage storage
int(* fpost)(struct soap *, const char *, const char *, int, const char *, const char *, ULONG64)
struct soap_dom_element * dom
int(* fresolve)(struct soap *, const char *, struct in_addr *inaddr)
void *(* fmimereadopen)(struct soap *, void *, const char *, const char *, const char *)
struct soap_clist * clist
struct SOAP_ENV__Header * header
int(* fdisconnect)(struct soap *)
void(* fmimereadclose)(struct soap *, void *)
char arrayOffset[SOAP_TAGLEN]
int(* fmimewrite)(struct soap *, void *, const char *, size_t)
size_t(* frecv)(struct soap *, char *, size_t)
void(* fseterror)(struct soap *, const char **c, const char **s)
int(* fpreparefinalrecv)(struct soap *)
struct soap_cookie * cookies
int(* fsvalidate)(struct soap *, const char *, const char *)
const char * proxy_passwd
int positions[SOAP_MAXDIMS]
int(* feltbegin)(struct soap *, const char *)
const char * long_double_format
const char * double_format
struct soap_nlist * nlist
const char * http_content
char arraySize[SOAP_TAGLEN]
char arrayType[SOAP_TAGLEN]
void(* fmimewriteclose)(struct soap *, void *)
const char * cors_methods
size_t(* fmimeread)(struct soap *, void *, char *, size_t)
char endpoint[SOAP_TAGLEN]
SOAP_SOCKET(* faccept)(struct soap *, SOAP_SOCKET, struct sockaddr *, int *n)
int(* fignore)(struct soap *, const char *)
const struct Namespace * namespaces
const char * ntlm_challenge
const char * cookie_domain
int(* ffilterrecv)(struct soap *, char *, size_t *, size_t)
int(* fparsehdr)(struct soap *, const char *, const char *)
struct Namespace * local_namespaces
struct soap_xlist * xlist
const char * cors_headers
struct soap_plugin * plugins
const char * http_extra_header
void *(* fplugin)(struct soap *, const char *)
#define Z_DEFAULT_STRATEGY
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy)
#define inflateInit2(strm, windowBits)
struct z_stream_s z_stream
#define inflateInit(strm)
#define deflateInit(strm, level)